arning: date(): It is not safe to rely on the......错误的解决办法
2013-07-12 17:35
633 查看
php提示PHP Warning: date(): It is not safe to rely on the......错误的解决办法
在写php程序中有时会出现这样的警告:PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods
and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in......
这是因为PHP默认获取的时间是格林威治标准时间,所以这个时间会和标准北京时间相差8个小时,对此我们可以用如下办法解决:
1、在页头使用date_default_timezone_set('PRC')设置时区为北京时间即可。
具体时区列表可参考:php中date时间相差8个小时的解决办法
2、在服务器配置文件 php.ini 中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时去掉前面的分号,即取消这一行代码的注释。
提示:date_timezone_set — 别名 DateTime::setTimezone()
相关文章推荐
- 关于php中Warning: date(): It is not safe to rely on the system's timezone settings.解决
- Warning: date(): It is not safe to rely on the system's timezone settings
- date(): It is not safe to rely on the system’s timezone settings.
- 解决php的“It is not safe to rely on the system’s timezone settings”问题
- date(): It is not safe to rely on the system's timezone settings in CodeIgniter
- 解决php的“It is not safe to rely on the system’s timezone settings”问题
- 解决php的It is not safe to rely on the system’s timezone settings的问题
- php异常 Message: date(): It is not safe to rely on the system's timezone settings
- "PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You
- PHP Warning: date(): It is not safe to rely on the system’s timezone settings
- 【Phpadmin】解决phpadmin的“It is not safe to rely on the system’s timezone settings”问题
- It is not safe to rely on the system's timezone settings错误
- 解决PHP date调用警告:It is not safe to rely on the system's timezone settings
- yii产生warning date(): It is not safe to rely on the system's timezone settings
- php Warning: date(): It is not safe to rely on the system's timezone settings.
- Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings.
- 解决PHP date调用警告:It is not safe to rely on the system's timezone settings
- Cacti编译安装错误: Warning: strtotime(): It is not safe to rely on the system's timezone settings.
- 解决php的“It is not safe to rely on the system’s timezone settings”问题
- 解决php的“It is not safe to rely on the system’s timezone settings”问题