2025-03-02 01:02:42
2025-03-02 03:40:23
1、在thinkphp 5当中,如果需要更新某个字段的值可以这样写:
Db::table('think_user')
->where('id', 1)
->update([ 'login_time' => ['exp','now()'],
'login_times' => ['exp','login_times+1'],
]);
或:
Db::table('think_user')->where('id',1)->setField('name', 'thinkphp');
2、如果是thinkphp 3.2 ,一般写法如下:
$User-> where('id=5')->setField('name','ThinkPHP');
2025-03-02 03:58:40