php脚本中使用date函数提示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 the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in /var/www/html/XXX/test.php on line 9。
这是因为没有设置默认时区导致的,解决方法
编辑/etc/php.ini文件找到;date.timezone =这一行,将;去掉并在=后面添加默认时区,如:
date.timezone = Asia/Chongqing
保存退出后重启Apache即可。

彭哥的IDC私房菜(www.urbansh.com)撰写,转载请注明出处http://www.urbansh.com/php-warning-date-it-is-not-safe.html