Laravel生成的created_at时间不对的问题
分类:PHP
阅读 (3,721)
11月 082018
今天发现有个表的created_at时间总是不对
用mysql查询select now()的时间是对的
开始还以为是被攻击了,后来百度了下发现是时区设置的问题
在config/app.php文件中将timezone的值改为如下就好了:
1 2 3 4 5 6 7 8 9 10 11 12 |
/* |-------------------------------------------------------------------------- | Application Timezone |-------------------------------------------------------------------------- | | Here you may specify the default timezone for your application, which | will be used by the PHP date and date-time functions. We have gone | ahead and set this to a sensible default for you out of the box. | */ 'timezone' => 'Asia/Shanghai', |
Sorry, the comment form is closed at this time.