php5.3的It is not safe to rely on the system’s timezone settings的問題的解決方案

訪問Yii框架自帶的例子系統時,頁面打印500錯誤:

Error 500

date() [<a href='function.date'>function.date</a>]: 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

經查和試驗解決方案爲:
在php.ini中設置時區:
date.timezone = "Asia/Shanghai"

或者在網頁開頭中加入:
<?phpdate_default_timezone_set("PRC");?>
相關文章
相關標籤/搜索