多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
>[danger] 自定时间戳在`数据库配置文件`中定义 + [自动时间戳官方手册](https://www.kancloud.cn/manual/thinkphp6_0/1037592) ``` config/database.php ``` ![](https://img.kancloud.cn/bc/ad/bcad001504484050431b279dba76280d_794x443.png) >[danger] 官方手册上说自动时间戳默认关闭 ? + [自动时间戳官方手册](https://www.kancloud.cn/manual/thinkphp6_0/1037592)上说是`默认关闭`的 + 但是在全局数据库配置文件中默认是`true`(开启) + 如果是我理解的不到位,可在本章节下方留下评论 ![](https://img.kancloud.cn/80/76/80769048fc74960a0ba024379c1b1c73_899x320.png) >[danger] 自动时间戳的两种配置支持 + 在配置文件中定义 `auto_timestamp` 配置项 + 如上图所示:在 config/database.php 中修改 + 在模型类中定义 `protected $autoWriteTimestamp` 属性 ~~~ // 开启自动时间戳 // 自动识别: true 指定字段类型: int timestamp datetime date protected $autoWriteTimestamp = true; // 关闭自动时间戳 protected $autoWriteTimestamp = false; ~~~