您的位置:首页 > 产品设计 > UI/UE

PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required*

2015-06-29 13:56 489 查看
PHP Warning:  Unknown: 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 'Asia/Chongqing' for 'CST/8.0/no DST' instead in Unknown on line 0

这个错误的原因是PHP没有设置时区, 所以解决方案很简单

方法一:

在页头使用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。打开php5.ini查找date.timezone 去掉前面的分号修改成为:date.timezone =PRC


详细请查看这里:http://www.cnblogs.com/jenry/archive/2011/01/21/1941497.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: