【发布时间】:2012-01-12 10:32:01
【问题描述】:
在 section_controller 中,我使用 loadmodel 在 section/index 文件中打印用户名,但出现错误:
注意 (8):未定义变量:用户 [APP\views\sections\index.ctp,第 3 行]
public function index ()
{
$this->loadModel('User');
$user = $this->User->find('all');
$this->Section->find('threaded', array('order' => array('Section.created ASC')));
$this->set('data','user');
}
在章节/索引中
<div><?php echo $user['User']['username']; ?></div>
【问题讨论】:
标签: php cakephp cakephp-1.3 cakephp-2.0 cakephp-1.2