php中的默认时区错误 [英] default timezone error in php

查看:318
本文介绍了php中的默认时区错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



<$ p $

p> 警告:
date_default_timezone_get():
依靠系统的时区设置是不安全的。
您需要*使用date.timezone设置或date_default_timezone_set()函数。
如果您使用任何这些方法,并且您仍然收到此警告,您很可能拼写时区标识符。
我们在C:\Server\apache\htdocs\kohana\system\core\Kohana.php第136行选择'亚洲/加尔各答'为$ 5.5 /否DST $ $ $ $ b

感谢提前!

解决方案

这不是一个错误,而是一个警告,所以它不会阻止您的应用程序的工作。



显式设置正确的时区使用date_default_timezone_set()在C:\Server\apache\htdocs\kohana\system\core\Kohana.php第136行



你必须选择< a href =http://it2.php.net/manual/en/timezones.asia.php =nofollow noreferrer>有效时区



< hr>

编辑



由于警告消息本身表示您实际上有一个更干净的选择,然后编辑第三方软件文件。即配置PHP应该是。




  • 编辑您的 php.ini 并调整价值 date.timezone = America / New_York






  • 在您的Web服务器配置中使用 php_value 指令将其设置为您的 vhost配置 .htaccess php_value date.timezone America / New_York


I got the following error/warning while tring to install Kohana/SilverStripe.
What does it mean and What do I do for it?

Warning:
date_default_timezone_get():
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 'Asia/Calcutta' for '5.5/no DST' instead in C:\Server\apache\htdocs\kohana\system\core\Kohana.php on line 136

Thanks in Advance!

解决方案

This is not an error, but a warning, so it does not block your app from working.

Explicitly set the right timezone using date_default_timezone_set() in C:\Server\apache\htdocs\kohana\system\core\Kohana.php on line 136

You have to choose among valid timezones


Edit

As the warning message itself states you actually have a more clean choice then editing a third party software file. I.e. configuring PHP as it should be.

  • edit your php.ini and adjust the value of date.timezone = America/New_York

or

  • use a php_value directive in your web server config to set it in your vhost configuration or .htaccess: php_value date.timezone America/New_York

这篇关于php中的默认时区错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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