thinkphp5.1-自动写入时间戳

在对应的模型里面写入

protected $autoWriteTimestamp = true;

就会为数据库中的create_time,delete_time,update_time自动记录下操作的时间

如果你的数据库的着三个属性不想这样命名,你想叫做create_timestamp。那么就需要在模型中增加protected $createTime = 'create_timestamp'这样的配置才可以自动写入时间戳。

猜你喜欢

转载自blog.csdn.net/EasyTure/article/details/109726447