PHP5.1以上版本使用Date函数时遇到警告的处理办法

来源:互联网 发布:linux root密码忘记了 编辑:程序博客网 时间:2024/05/23 13:06

PHP5.1以上版本使用Date函数是会遇到这样的Warning:


"PHP Warning: date() [function.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中的时区没有设置或是使用的函数不对!


大家可以尝试在PHP的安装文件里找到php.ini(配置过以后的文件),然后Ctrl+F查找“date.timezone”,(没记错应该是第二个文件),配置文件里显示的是“date.timezone=”这一句话需要修改,将前面的去掉,然后在=后面添加上PRC,这代表将时区功能开启设置,并设置成中国(PRC)时区!


最后,一定要重启服务器(Apache,或是IIS),然后问题就解决了!!!

0 0
原创粉丝点击