我正在学习CakePHP。我想将获取的数据从控制器传递到视图页面。
Controller(ProfileController)
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
答案 0 :(得分:0)
将您的视图download_result.ctp放入cake / app / views / profile /
现在,我建议您停止使用这样的旧版本,并开始使用版本3.x学习,最新版本会更好,Cakephp 3.2。
没有必要从旧版本开始,特别是因为它们之间的变化很大(并且因为新的东西几乎更好)。