PHP date()函数警告: It is not safe to rely on the system解决方法
近来总是有系统邮件提示,开始没在意,后来不断提示就看了一下。提示以下信息
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 gett
ing this warning, you most likely misspelled the timezone identifier. we selected 'asia/chongqing' for 'cst/8.0/no dst' instead in /data0/htdocs/www.qttc.net/function/function.php on line 542
大体是说timezone没有设置,在中国使用的是格林+8小时,所以需要设置一下。
第一种
在页面头部加入以下语句
date_default_timezone_set("prc");
这种方法有个缺点,就是所有的页面都得添加
第二种
在php.ini里找到date.timezone这行,把值改成prc,如date.timezone = prc。如果没有这一行直接加上就好。最后重启web服务器与php即可。
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
荐
数据库的设计
数据库的设计一 为什么需要规范的数据库设计数据库设计的步骤收集信息标识实体标识每个实体需要存储的详细信息标识实体...
[阅读全文]
-
-
-
-
-
-
-
网友评论