我正在学习CakePHP.我想将获取的数据从控制器传递到查看页面。
控制器(配置文件控制器)
public function download_result($poll_id)
{
$this->_checkVipSession();
$this->Poll->bindModel(array('hasMany' => array('PollAnswer' => array('foreignKey' =>'poll_id'))), false);
$condition = "Poll.id = ".$poll_id." AND Poll.isdeleted = '0' ";
$poll_info = $this->Poll->find('first',array('conditions'=>$condition));
$this->set('poll_info',$poll_info);
Configure::write('debug', '2');
}
视图(download_result.ctp)
<?php
echo "<pre>";
print_r($poll_info);
?>
它给出一个错误,如下所示:
Missing View
Error: The view for ProfileController::download_result() was not found.
Error: Confirm you have created the file: /home/webbrain/public_html/cake/app/views/profile/download_result.ctp
Notice: If you want to customize this error message, create app/views/errors/missing_view.ctp
那么我该如何解决呢?
注意:我使用了CakePHP版本1.3.13
将您的视图download_result.ctp 放入蛋糕/应用程序/视图/配置文件/
现在,我建议您停止使用这样的旧版本并开始学习 3.x 版本,最新的会更好,Cakephp 3.2。
没有必要从旧版本开始,特别是因为它们之间的变化很大(而且因为新东西几乎更好)。