茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1729118 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_60D_00194.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

PHP特區 : [分享]PHP 5.3.0 碰上 Date Function Warning

發表者 討論內容
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15771
[分享]PHP 5.3.0 碰上 Date Function Warning
冷日某個Case使用了最新版得XAMPP!
她的PHP版本是:PHP Version 5.3.0。
然後Case中,所有與『Date』有關的函數(Function)全部出現Warning,大致上主要在說的是:
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.


冷日稍微掃了一下,目前看起來,strtotime()、date()、mktime() 等都會出這個問題!
目前猜測應該是所有的DateTime都會有這個Warning!

這裡提供一些解決方案:
1.在你會用到datetime函式前,先使用:
date_default_timezone_set('Asia/Taipei');

2.或是乾脆寫一個全域的參數(冷日很愛用這招):
date_default_timezone_set('UTC+8');

3.不然,就直接在php.ini裡加上(預設是被makr掉的空白):
date.timezone=Asia/Taipei


這樣大家就可以繼續高高興興的使用各式DateTime Function了!
推眼鏡
前一個主題 | 下一個主題 | | | |

討論串




Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|