【问题标题】:I am getting warning about timezone settings on my blog page [duplicate]我在我的博客页面上收到有关时区设置的警告 [重复]
【发布时间】:2013-04-04 09:16:21
【问题描述】:

我正在使用简码在我的博客页面上显示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');

但没有运气。

现在需要你们的帮助。谢谢...

【问题讨论】:

  • 你试过在php.ini中设置默认时区吗?
  • 正在我客户的服务器上工作,无法更改。
  • 这个答案在我的情况下不起作用:stackoverflow.com/questions/5535514/…。我已经在我的问题中提到我尝试了error_reporting()date_default_timezone_set() 但没有运气。

标签: php wordpress date warnings


【解决方案1】:

试试这个:

 date_default_timezone_set("Australia/Perth");

date.timezone = Australia/Perth

使用date_default_timezone_get(); 而不是date();

【讨论】:

  • 需要其他选择,因为我在我的短代码中使用了太多时间 date() 函数。
  • 尝试先设置 date.timezone
  • 错误:date.timezone 它说unexpected =
  • 我都试过了,在我的问题中也提到了。没有运气
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-11-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多