After using AJAX to submit the data to be updated, I want to know what data is received in the controller. Is it the data in my table? Or is it the data for judgment?
--------------------------------------------- -------------------------------------
PhpNewer2018-05-19 17:12:33
$data is all the data of the form submitted by your front end through ajax. This is an associative array. tp5 uses json by default. Are you using dump output to verify the data in $data?
updata() Shouldn’t the sql statement of mysql be executed here? How can I execute $data directly?
圐圙2018-05-19 14:13:21
$name= $this->request->param('name');
$add= $this->request->param('add');
$time= $this->request->param('update_time');
$a = Db::name('dh')
->where('id',$s)
- >data(['name' => $name,
'add'=>$add,
'update_time'=>$time
])
->update( );
Do you have to ask me to write like this? What if I have many fields to change?