It is not safe to rely on the system's timezone settings. 的PHP问题处理
2017-07-11 21:38
543 查看
实际上,从PHP 5.1.0,当对使用date() 等函数时,如果 timezone 设置不正确,在每一次调用时间函数时,都会产生 E_NOTICE 或者 E_WARNING 信息。而又在 PHP 5.1.0 中,date.timezone 这个选项,默认情况下是关闭的,无论用什么PHP 命令都是格林威治标准时间,但是PHP 5.3 中好像如果没有设置也会强行抛出了这个错误的,解决此问题,只要本地化一下就行了。
一、在页头使用date_default_timezone_set()设置 date_default_timezone_set(‘PRC’); //东八时区 echo
date(‘Y-m-d H:i:s’);
二、在页头使用 ini_set(‘date.timezone’,’Asia/Shanghai’);
三、修改 php.ini(php安装目录下)。使用记事本打开 php.ini 查找 date.timezone 去掉前面的分号修改成为:date.timezone = PRC
重启http服务(如apache2或iis等)即可!
以上三种方法任选其中一种即可,小编推荐使用第三种方法,不用每次都要增加额外的代码。
相关文章推荐
- 解决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的It is not safe to rely on the system’s timezone settings的问题
- home 解决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的“It is not safe to rely on the system’s timezone settings”问题
- php5.3的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”问题
- PHP Warning: phpinfo(): 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的问题
- PHP 日期问题 PHP Warning: 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的问题
- 解决php的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.
- PHP Warning: strtotime() [function.strtotime]: It is not safe to rely on the system’s timezone settings. 解决方法:
- PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings
- PHP Warning: phpinfo(): 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