[開發筆記] Codeigniter 2碰上php 5.3的date()問題

買了新的mac,裡面預設的php版本就是5.3的。

結果我把本來寫好的code,移殖過來的時候,發現了錯誤
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.
在網路上找了資料,最後是在根目錄底下的index.php的一開始加上:

ini_set('date.timezone', 'Asia/Taipei'); 
if( !ini_get('date.timezone') )
{
  date_default_timezone_set('Asia/Taipei');
就解決了。

留言

張貼留言

這個網誌中的熱門文章

免費電子書下載網站

[自助旅行攻略] 京都、大阪、奈良攻略總整理分享

[清邁自助行]【推薦】台灣人開的漢清邁旅行社