问题描述:
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
原因分析:
date.timezone默认是格林威治标准时间(GMT),如果timezone设置不正确,每次调用时间函数时,都会产生E_NOTICE 或者 E_WARNING 信息。解决此问题,需将时区设置为本地所在时区。解决方案:
- 方法一:在页头使用date_default_timezone_set()设置
date_default_timezone_set('PRC'); //东八时区
- 方法二:在页头使用
ini_set('date.timezone','Asia/Shanghai');
- 方法三:修改php.ini配置文件(修改保存后,需重启apache)。找到“;date.timezone”修改成
date.timezone = Asia/Shanghai
原文地址:
https://blog.csdn.net/jordanmicle/article/details/83671031