|
近來(lái)總是有系統(tǒng)郵件提示,開始沒在意,后來(lái)不斷提示就看了一下。提示以下信息
復(fù)制代碼 代碼如下:
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 gett
ing this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /data0/htdocs/www.qttc.NET/function/function.php on line 542
大體是說(shuō)timezone沒有設(shè)置,在中國(guó)使用的是格林+8小時(shí),所以需要設(shè)置一下。
第一種
在頁(yè)面頭部加入以下語(yǔ)句
復(fù)制代碼 代碼如下:
date_default_timezone_set("PRC");
這種方法有個(gè)缺點(diǎn),就是所有的頁(yè)面都得添加
第二種
在php.ini里找到date.timezone這行,把值改成PRC,如date.timezone = PRC。如果沒有這一行直接加上就好。最后重啟WEB服務(wù)器與php即可。
php技術(shù):PHP date()函數(shù)警告: It is not safe to rely on the system解決方法,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。