手机
当前位置:查字典教程网 >编程开发 >php教程 >PHP date()函数警告: It is not safe to rely on the system解决方法
PHP date()函数警告: It is not safe to rely on the system解决方法
摘要:近来总是有系统邮件提示,开始没在意,后来不断提示就看了一下。提示以下信息复制代码代码如下:PHPWarning:date():Itisnot...

近来总是有系统邮件提示,开始没在意,后来不断提示就看了一下。提示以下信息

复制代码 代码如下:

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即可。

【PHP date()函数警告: It is not safe to rely on the system解决方法】相关文章:

fckeditor上传文件按日期存放及重命名方法

PHP5/ZendEngine2的改进

PHP 判断数组是否为空的5大方法

PHP怎样调用MSSQL的存储过程

PHP中的类型约束介绍

php简单实现多字节字符串翻转的方法

图书管理程序(一)

PHP file_get_contents函数读取远程数据超时的解决方法

PHP date函数常用时间处理方法

用Socket发送电子邮件

精品推荐
分类导航