2013-04-04 22 views
1

上午在我的博客頁面上使用簡碼顯示PHP Date Picker。但低於警告。我在我的博客頁面上收到關於時區設置的警告

Warning: date() [function.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. We selected 'Australia/Perth' for 'WST/8.0/no DST' instead in /home/xxx/public_html/wp-content/plugins/xxx/calendar/calendar_form.php on line 48

我的服務器PHP版本是:5.3.19

我要如何擺脫這一警告的?

我試圖隱藏PHP警告,但沒有成功,仍然得到警告。

error_reporting(E_ALL^ (E_WARNING | E_NOTICE));

此外,我試圖設置時區爲:

date_default_timezone_set('Australia/Perth');

,但沒有運氣。

現在需要你的幫助球員。謝謝...

+0

你試過設置php.ini中默認的時區? – aleation 2013-04-04 09:23:59

+0

我正在我的客戶端的服務器上工作,無法更改此設置。 – Frank 2013-04-04 09:29:57

+0

此答案不適用於我的情況:http://stackoverflow.com/questions/5535514/how-to-fix-warning-from-date-in-php。我已經提到在我的問題,我嘗試'error_reporting()'&'date_default_timezone_set()',但沒有運氣。 – Frank 2013-04-04 11:18:35

回答

0

試試這個:

date_default_timezone_set("Australia/Perth"); 

date.timezone = Australia/Perth 

使用date_default_timezone_get();代替date();

+0

需要其他替代方法,因爲在我的短代碼中使用了太多時間'date()'函數。 – Frank 2013-04-04 09:21:53

+0

嘗試設置第一個date.timezone – 2013-04-04 09:22:45

+0

錯誤:date.timezone它說'意外=' – Frank 2013-04-04 09:24:39

相關問題