在写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提示maximum execution time of 30 seconds exceeded...错误的解决办法phpmyadmin cannot start session without errors错误解决办法php提示call to undefined function curl_init() 错误的解决办法select into from 提示 undeclared variable.....错误的解决办法dedecms中提示dedetag engine create file false的错误的解决办法firefox 提示event is not defined错误的解决办法fatal error class 'soapclient' not found in ...错误处理办法xdebug的进度条停在57%,提示waiting for xdebug session错误的解决办法
http://www.bkjia.com/phpjc/764187.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/764187.htmltecharticle在写php程序中有时会出现这样的警告: php warning: date(): it is not safe to rely on the system's timezone settings. you are *required* to use the date.timezone setti...