一、模型自动时间戳 1、如果你想全局开启,在database.php中,设置为true //自动写入时间戳字段 'auto_timestamp'=>true; 2、如果只想设置某一个模型开启,需要设置特有字段 //开启自动时间戳 protected $autoWriteTimestamp=true; 3、自动时间戳开启后会自动写入create_time和update_time两个字段,默认类型是int,如果是时间类型,可以更改如下 'auto_timestamp'