处理PHP函数中使用date命令时的Warning

     2014年04月27日       磊磊syh       非专业笔记->PHP       php date 

在PHP代码中调用date函数时,在日志里看到如下报错

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 getting this warning, 
you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead

为什么会出现这样的报错?

处理方法1
在调用date前加入下代码

ini_set('date.timezone','Asia/Shanghai');