thinkphp 更新 model 字段的方法

更新日期: 2019-08-30 阅读次数: 6251 字数: 37 分类: thinkphp

方法一

类似 laravel

$user = User::get(1);
$user->name =  'zhongwei';
$user->save();

thinkphp 3.2.3 的做法

$Config = M('Config', 'zh_');
//$tel = $Config->where('id=1')->find();
$Config->where('id=1')->setField('val', 123);

参考

https://www.kancloud.cn/manual/thinkphp5/135189

关于作者 🌱

我是来自山东烟台的一名开发者,有敢兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式