1、控制器GlobalController.class.php的代码:
public function index(){
if(IS_POST){
$site = D('Site'); //此处改为D('Global');
if($site->create()){
$site->update()!==false ? $this->success() : $this->error();
}else{
$this->error($site->getError());
}
}else{
//显示模板
}
}2、模型GlobalModel.class.php的代码: public function update(){
$rs = $this->create();
if(!$rs){ //数据对象创建错误
return false;
}
if(empty($rs['id'])){
$this->add();
}else{
$this->save();
}
}3、点击提交修改后提示错误:Think\Model:update方法不存在!
最佳答案