php.ini'date.timezone'无效 [英] php.ini 'date.timezone' doesn't have any effect

查看:239
本文介绍了php.ini'date.timezone'无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 php.ini 中,设置:

date.timezone = "Etc/UTC"

服务器的时间也是UTC + 0,但是当我尝试使用此脚本获取时时区:

And the server's time is UTC+0 too, but when I try this script to get the timezone:

<?php print(date_default_timezone_get()); ?>

返回


欧洲/柏林

Europe/Berlin

这是 UTC + 2 而不是 UTC + 0 ,但我不知道它是怎么到达的。

which is UTC+2 and not UTC+0 and I don't see how it gets there.

只需澄清一下:


  • 我已在正确的路径中保存了正确的文件并重新启动了服务器

  • 我不想修改我的脚本,因为我已经经常使用 date()的方式

  • 我希望时间是 UTC +只需通过更改配置即可将PHP设置为0

  • 我希望一直将其设置为 UTC + 0 ,忽略夏季/冬季时间

  • I have saved the the correct file at the correct path and restarted my server
  • I do not want to modify my scripts, because I already used date() way to often
  • I want the time to be UTC+0 for PHP just by changing the configuration
  • I want it to be UTC+0 at all times, ignoring Summer-/Wintertime

推荐答案

在注释中,Minesh Patel 告诉我要检查是否覆盖了我的选项,因此我在 php.ini 中搜索了欧洲/柏林事实证明还有另一个 d ate.timezone -覆盖了它的条目。

In the comments, Minesh Patel told me to check if there is something overwriting my option, so I searched through my php.ini for Europe/Berlin and it turns out there was another date.timezone-entry that overwrote it.

这篇关于php.ini'date.timezone'无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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