停止警告:date()[function.date]:从本地主机 [英] Stop Warning: date() [function.date]: from localhost

查看:197
本文介绍了停止警告:date()[function.date]:从本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


警告:date()[function.date]:依靠系统的时区设置是不安全的。您需要 使用date.timezone设置或date_default_timezone_set()函数。如果您使用任何这些方法,并且您仍然收到此警告,您很可能拼写时区标识符。我们选择了............

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

有许多Web应用程序弹出这个特定的错误。我可以设置

There are many web applications that spring up this particular error. I could set

date_default_timezone_set('America/Los_Angeles');

但这不是我正在寻找的解决方案。

But that is not the solution I am looking for.

我可以从系统级别做一些事情。它只发生在 LOCALHOST 不在实际的生产服务器上。

Can I do something from system level. It happens only on LOCALHOST not on the actual production server.

在php.ini中设置的默认值为date.timezone = America / Los_Angeles

[更新] 编辑php.ini

[update] edited php.ini


警告:phpinfo()[function.phpinfo]:依靠系统的时区设置是不安全的。您需要使用date.timezone设置或date_default_timezone_set()函数。如果您使用任何这些方法,并且您仍然收到此警告,您很可能拼错了时区标识符

Warning: phpinfo() [function.phpinfo]: 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.ini 设置 date.timezone =

The reason it is happending on one server and not the other is the php.ini setting date.timezone=.

尽管如此,您仍然需要选择一个实际值。你确实没有一个。或者错误的php.ini版本(有一个用于CLI,一个用于mod_php)。

You would still need to pick an actual value though. You assuredly don't have one. Or in the wrong php.ini version (there's one for CLI and one for mod_php).

这篇关于停止警告:date()[function.date]:从本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆