Vin*_* VT 1 cakephp cakephp-2.0
我在我的模型中使用此代码,
public function registration(){
$name = 'Foo';
$city = 'Bar';
$this->User->save(
array(
'name' => $name,
'city' => $city
)
);
}
Run Code Online (Sandbox Code Playgroud)
但插入时会出现致命错误
"Error: Call to a member function save() on a non-object
File: C:\xampp\htdocs\blogs\app\Model\User.php"
Run Code Online (Sandbox Code Playgroud)
如何插入?
Bar*_*man 12
你已经在User模特中了.只需执行以下操作:
$this->save(
array(
'name' => $name,
'city' => $city
)
);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11272 次 |
| 最近记录: |