PHP Warning 時區沒有設定警告 – date(): It is not safe

最近查看Apache Log 發現常常會出現:

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.....

原來在PHP 5.1.0開始在呼叫date此函式時,timezone設定不正確就會有以上警告,此時只需修改php.ini找到date.timezone改為

date.timezone = Asia/Taipei //依據所在時區設定

 

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *