我正在使用 cakephp 开发一个网络应用程序。我有一个函数,我想使用 cakephp 的 save() 方法将一些数据保存到模型中。但是每当我要保存数据时,我都会遇到这种错误:
Fatal error: Call to undefined method App::save() in /httpdocs/MyApp/app/Controller/AppsController.php on line 71
任何人都知道我在这里缺少什么。我的控制器的功能如下:
public function add_app($id=null){
$this->layout = 'user';
if (!empty($id)) {
$this->request->data['App']['id_users'] = $_SESSION['edit_user_id'];
$this->request->data['App']['id_store'] = $id;
$this->request->data['App']['id_unique_app'] = $Guid;
$this->request->data['App']['tx_app_name'] = $data['results'][0]['trackName'];
$this->request->data['App']['tx_platform'] = 'iOS';
$this->request->data['App']['nu_price'] = $data['results'][0]['price'];
$this->request->data['App']['da_created'] = date("Y-m-d H:i:s");
if ($this->App->save($this->request->data)) {
$this->Session->setFlash('The selected app has been added successfully.');
$this->redirect(array('action' => 'index'));
}
}
}
提前致谢。