php date("Y-m-d H:i:s") 出現警告信息


使用:

$createtime=date("Y/m/d H:i:s", time()+16*60*60);

$createtime=date("Y-m-d H:i:s");//時間。。H表示24小時制

提交表單后出現如下錯誤提示:

Strict Standards: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 C:\AppServ\www\www\phpsql\check_add.php on line 11

 

解決方法:

方案1:check_add.php頭部:<?php date_default_timezone_set("PRC");  ?>  設置默認時區為北京時間。。解決當前頁面。

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

   解決所有頁面使用時間的問題。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM