使用update去更新字段.字段是序列化类型的.已经在model里设置好了type
protected $type = [
'exam_subject'=>'serialize',
'section' => 'serialize',
'excellent_good' => 'serialize',
'upgrade_data' => 'serialize',
];
使用update去更新的时候.会提示未定义数组下标0 $a=[
'sdf'=>123,
"123"=>333,
];
$aa = $model->where('id',$ids)->update(['section'=>$a]);
但是我如果先用get读取这条记录.在通过save去保存修改.就会自动序列化,不会报错.为啥?$a=[
'sdf'=>123,
"123"=>333,
];
$row = Exam::get($ids);
$row->section = $a;
$aa = $row->save();
最佳答案
