解决php It is not safe to rely on the system's timezone settings. You are *required* to use the date.

来源:互联网 发布:mac系统用windows软件 编辑:程序博客网 时间:2024/05/01 08:56

It is not safe to rely on the system,其实是时区设置不正确造成的。
从PHP 5.1.0开始当对使用date()等函数时,如果timezone设置不正确,在每一次调用时间函数时,都会产生E_NOTICE 或者 E_WARNING 信息,而又在php中,date.timezone这个选项,默认情况下是关闭的,无论用什么php命令都是格林威治标准时间,需要自己配置的环境的就更加会容易出现这个情况

解决方法:在php.ini里加上找到date.timezone项,设置date.timezone = “Asia/Shanghai”,重启环境就ok了。

0 0
原创粉丝点击