PHP date()函數(shù)警告: It is not safe to rely on the system解決方法
近來(lái)總是有系統(tǒng)郵件提示,開(kāi)始沒(méi)在意,后來(lái)不斷提示就看了一下。提示以下信息
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沒(méi)有設(shè)置,在中國(guó)使用的是格林+8小時(shí),所以需要設(shè)置一下。
第一種
在頁(yè)面頭部加入以下語(yǔ)句
date_default_timezone_set("PRC");
這種方法有個(gè)缺點(diǎn),就是所有的頁(yè)面都得添加
第二種
在php.ini里找到date.timezone這行,把值改成PRC,如date.timezone = PRC。如果沒(méi)有這一行直接加上就好。最后重啟WEB服務(wù)器與PHP即可。
相關(guān)文章
phpstudy 進(jìn)行 composer 全局配置的操作步驟
使用 phpStudy 進(jìn)行環(huán)境搭建時(shí),有時(shí)需要使用 composer 每次都需要查找資料進(jìn)行配置,在此進(jìn)行記錄筆記,方便有需要的道友借鑒,對(duì)phpstudy全局配置composer的操作步驟感興趣的朋友跟隨小編一起看看吧2023-08-08php + WebUploader實(shí)現(xiàn)圖片批量上傳功能
這篇文章主要給大家介紹了利用php + WebUploader實(shí)現(xiàn)圖片批量上傳功能的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用PHP具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-05-05Swoole?webSocket客服IM消息系統(tǒng)方案解析
這篇文章主要為大家介紹了Swoole?webSocket客服IM消息系統(tǒng)方案解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-03-03PHP錯(cuò)誤Warning: Cannot modify header information - headers alr
這篇文章主要介紹了PHP錯(cuò)誤Warning: Cannot modify header information - headers already sent by解決方法,需要的朋友可以參考下2014-09-09CodeIgniter配置之routes.php用法實(shí)例分析
這篇文章主要介紹了CodeIgniter配置之routes.php用法,結(jié)合實(shí)例形式分析了routes.php中常用配置參數(shù)的含義及具體使用技巧,需要的朋友可以參考下2016-01-01如何解決phpmyadmin導(dǎo)入數(shù)據(jù)庫(kù)文件最大限制2048KB
這篇文章主要介紹了如何解決phpmyadmin導(dǎo)入數(shù)據(jù)庫(kù)文件最大限制2048KB的相關(guān)資料,需要的朋友可以參考下2015-10-10