色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

關于php程序報date()警告的處理(date_default_timezone_set)

在寫php程序中有時會出現這樣的警告:

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 'UTC' for '8.0/no DST' instead in D:/phpWEB ews/file.php on line 17 。

這是因為php所取的時間是格林威治標準時間,所以和你當地的時間會有出入格林威治標準時間和北京時間大概差8個小時左右,我們可以按照下面的方法解決:

1、在頁頭使用date_default_timezone_set()設置我的默認時區為北京時間,即 <?php date_default_timezone_set("PRC"); ?>就可以了。

2、在php.ini中設置date.timezone的值為PRC,設置好以后的為:date.timezone=PRC或者date.timezone = Asia/Shanghai,同時取消這一行代碼的注釋,即去掉前面的分號就可以了。

然后重啟apache即可!

php技術關于php程序報date()警告的處理(date_default_timezone_set),轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 秀山| 江油市| 三明市| 华蓥市| 兰西县| 宜黄县| 旺苍县| 巴林右旗| 万宁市| 阜新| 科尔| 浏阳市| 武穴市| 静宁县| 黄浦区| 昌江| 南皮县| 德钦县| 德令哈市| 滨海县| 利津县| 朔州市| 天津市| 揭西县| 兴义市| 林芝县| 武山县| 博客| 宁德市| 新干县| 南安市| 丰宁| 永康市| 荣昌县| 德安县| 寻乌县| 阿勒泰市| 社旗县| 沐川县| 海兴县| 长白|