当前位置:首页 > ThinkPHP > 关键词 > 函数 > 正文

ThinkPHP使用update函数更新数据的方法

ThinkPHP使用update函数更新数据的方法
Db::table('user')
    ->where('id', 1)
    ->update(['name' => 'zhimatong']);

更新多个字段的写法:

Db::table('user')
    ->where('id', 1)
    ->update([
        'login_time'  => ['exp','now()'],
        'login_times' => ['exp','login_times+1'],
    ]);

本文属原创,转载请注明原文:https://www.zhimatong.com/jiaocheng/844.html

为保证教程的实用性及扩大知识面覆盖,如果您有相似问题而未解决,可联系在线客服免费技术支持。

点赞 1