"PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You

"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_default_timezone_set();設置 date_default_timezone_set('PRC'); //東八時區 echo 
date('Y-m-d H:i:s');

二、在頁頭使用 ini_set('date.timezone','Asia/Shanghai');

三、修改 php.ini :使用記事本打開 php.ini  ctrl+f  查找 date.timezone 去掉前面的分號修改成爲:date.timezone = PRC



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章