laravel报错 MassAssignmentException

为模型不允许通过数组进行注入数据导致错误

解决方法

方法一

设置不可注入数据字段为空

protected $guarded=[]; //不可以注入的数据字段

 

方法二

设置可以注入数据字段

protected $fillable=['str1','str2']; //可以注入的数据字段

猜你喜欢

转载自blog.csdn.net/sqlquan/article/details/81153830