我是php新手。我有一个简单的错误,但无法解决问题。
错误:在非对象上调用成员函数find()
文件: /var/www/html/cake27/Temploc/Controller/TemperatureReadingsController.php
行:59
这是订单中脚本的一部分,并且对58,59,60,61行进行了分类:
public function edit($id = null) {
if (!$this->TemperatureReading->exists($id)) {
throw new NotFoundException(__('Invalid temperature reading'));
}
if ($this->request->is(array('post', 'put'))) {
if ($this->TemperatureReading->save($this->request->data)) {
$this->Session->setFlash(__('The temperature reading has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The temperature reading could not be saved. Please, try again.'));
}
} else {
$options = array('conditions' => array('TemperatureReading.' .$this->TemperatureReading->primaryKey => $id));
$ this-> request-> data = $ this-> TemperatureReading-> find(' first',$ options);
58- }
59- $locations = $this->TemperatureReading->Location->find('list');
60-
$this->set(compact('locations'));
61- }