thinkphp5 模型时间戳自动写入 不生效原因

模型时间戳

1、模型层代码如下:

<?php
namespace app\admin\model;

use think\Model;

class User extends Model
{
    protected $autoWriteTimestamp = true;     //开启自动写入时间戳
    protected $createTime = false;            //数据添加的时候,create_time 这个字段不自动写入时间戳
    protected $updateTime = ”update_at“;     //数据更新的时候,update_at 这个字段自动写入时间戳
}

注:自动写入时间戳只能用save()方法,insert和update方法是无效的;

 

猜你喜欢

转载自blog.csdn.net/Chen_start02/article/details/84615281