我想编辑行。查看文件包含使用 Ajax 的 dropwons。我用 $this->data = $this->CourseBuilding->read(null, $id); 但它无法读取该 ID 的所有字段。
你能帮我吗。
我想编辑行。查看文件包含使用 Ajax 的 dropwons。我用 $this->data = $this->CourseBuilding->read(null, $id); 但它无法读取该 ID 的所有字段。
你能帮我吗。
从http://api.cakephp.org/class/model#method-Modelread - 您可以将所需的所有字段作为参数传递给 read 方法,如下所示:
$this->CourseBuilding->read(array('field1', 'field2', ...), $id);
或者您可以改用它:
$this->CourseBuilding->findById($id);
$this->CourseBuilding->read('*',$id);
通过使用 * 作为 read 方法的第一个参数将返回该模型的所有字段。
将 id 传递给 url 名称 id
然后当检索数据使用$id=$this->params['id'];
和
$this->Your model name->id = $id;
$this->data = $this->Your model name->read();
你会收到你的数据
谢谢梅胡尔