2011-11-13 101 views
0

作爲CakePHP的新手,我有這樣的錯誤:CakePHP的:解析錯誤:語法錯誤,意想不到的T_DOUBLE_ARROW

Parse error: syntax error, unexpected T_DOUBLE_ARROW

我使用CakePHP的2.0和我LogsController我:

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

任何想法,我怎麼能解決這個問題?

回答

3

您應該將「字段」數組中:

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

當我這樣做,我得到這個錯誤,「調用一個成員函數find()方法。」在同一直線上。 :? – Sushil

+1

然後'標題'不是一個模型或不在上下文中加載。 – topek

+0

謝謝..「$ this-> loadModel('Title');」做了這份工作。 :) – Sushil

相關問題