tp5框架询问
问题描述
public function doEdit(Request $request) { $data = $request ->except('shebei'); $condition = ['id'=>$data['id']];$result = GongyikaModel::update($data,$condition);$status = 0;$message = '更新失败,请检查'; if (true == $result) { $status = 1; $message = '恭喜, 更新成功~~';}return ['status'=>$status, 'message'=>$message]; }
请问老师$data['id']这个ID运行时候咋获取不到是空的
return $this->view->fetch('gongyikabianji'); } public function doEdit(Request $request) {$data = $request ->except('shebei');$condition = ['id'=>$data['id']];$result = GongyikaModel::update($data,$condition);$status = 0;$message = '更新失败,请检查'; if (true == $result) { $status = 1; $message = '恭喜, 更新成功~~';}return ['status'=>$status, 'message'=>$message]; }
问题解答
回答1:打印下$data,看看里面有ID吗?没有的话就是前端写的有问题。
相关文章: