thinkphp5过滤非数据表字段

DB操作可以使用 strict 关闭字段严格检查:

Db::name('admin')->strict(false)->insert($data);

模型操作可以使用 allowfield 过滤非数据表字段数据

$user->allowfield(true)->save($data)

还有一个 php 的 unset() 销毁变量也可以使用哈,

unset($data['file'])

猜你喜欢

转载自blog.csdn.net/hgb24660/article/details/100053057