CakePHP:解析错误:语法错误,意外T_DOUBLE_ARROW

时间:2011-11-13 22:15:11

标签: cakephp cakephp-2.0

作为CakePHP的新手,我有这个错误:

  

解析错误:语法错误,意外T_DOUBLE_ARROW

我正在使用CakePHP 2.0,而在LogsController我有:

$conditions = array("Title.id" => $id);
$currentUser = $this->Title->find('first', array('conditions' => $conditions), 'fields'=>array('user_id'));

任何想法,我怎么能解决这个问题?

1 个答案:

答案 0 :(得分:4)

你应该在数组中放置'fields':

$currentUser = $this->Title->find('first', array('conditions' => $conditions, 'fields'=>array('user_id')));