代码:
public function index()
{
$result = Db::name('user')
->where('id',15)
->update([
'create_time'=>['exp','now()'],
'update_time'=>['exp','create_time+1'],
]);
return $result;
}
错误提示:
不支持的数据表达式:[exp]
修改:
- Db::table('think_user')
- ->where('id', 1)
- ->update([
- 'login_time' => Db::raw('now()'),
- 'login_times' => Db::raw('login_times+1'),
- ]);