我有一个问题请帮帮我
感谢..
我的蛋糕php是2.5.4,我使用的是xampp ver 3.2.1,但是我收到了这个错误。
Warning (2): Illegal offset type [CORE\Cake\Model\Model.php, line 2978]
警告(2):非法偏移类型[CORE \ Cake \ Model \ Model.php,第2956行]
我的视角是:
public function edit($id=null) {
if(!$id) {
$this->Session->setFlash('not found this job');
$this->redirect(array('action'=>'index'),null,true);
}
if(empty($this->data)) {
$this->data=$this->Task->find(array('all',array('conditions'=>array('id'=>$id))));
} else {
if($this->Task->save($this->data)) {
$this->Session->setFlash('updated');
$this->redirect(array('action'=>'index'),null,true);
} else {
$this->Session->setFlash('this up date has problem !!! ');
}
}
}
我的控制器是:
public function edit($id=null) {
if(!$id) {
$this->Session->setFlash('not found this job');
$this->redirect(array('action'=>'index'),null,true);
}
if(empty($this->data)) {
$this->data=$this->Task->find(array('all',array('conditions'=>array('id'=>$id))));
} else {
if($this->Task->save($this->data)) {
$this->Session->setFlash('updated');
$this->redirect(array('action'=>'index'),null,true);
} else {
$this->Session->setFlash('this up date has problem !!! ');
}
}
}
请帮帮我
答案 0 :(得分:2)
你使用Model::find()
错误,应该传递什么作为单独的参数包含在数组中。
必须是
find('all', array('conditions' => /* ... */));
不
find(array('all', array('conditions' => /* ... */)));