SETENV TZ VS date.timezone [英] SetEnv TZ vs date.timezone

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

问题描述

是什么在设置时区之间的差别的Apache的 SETENV TZ (适用的.htaccess)和PHP的 date.timezone (php.ini中)?我一直无法检测到如何 SETENV TZ 被使用。我试着设置的 SETENV TZ ,以一个值和 date.timezone 到另一个时区,但只有后者, date.timezone ,似乎有什么影响在网页上。我也想知道configuratoins和PHP配置Apache的如何,对于同样的事情,影响服务器,覆盖比如那个。

What is the difference between setting the timezone in Apache's SetEnv TZ (.htaccess) and PHP's date.timezone (php.ini)? I haven't been able to detect how SetEnv TZ gets used. I tried setting SetEnv TZ to one value and date.timezone to another timezone but only the latter, date.timezone, seems to have any effect on the web pages. I'm also wondering how Apache configuratoins and PHP configurations, for the same things, affect the server, such as which overwrites which.

推荐答案

该URL的 http://www.php.net/manual/en/function.date-default-timezone-get.php 应该给你确切的答案;在短(假设最近的PHP> 5.4.0版本),它会检查一组用PHP内date_default_timezone_set(),如果没有设置,检查date.timezone的php.ini中的价值。如果一个没有设置 - 它放弃。所以TZ被忽略。

The URL http://www.php.net/manual/en/function.date-default-timezone-get.php should give you the exact answer; in short (assuming a recent version of php > 5.4.0) it checks for the one set with date_default_timezone_set() within php and if not set, checks the value of date.timezone in php.ini. If that one is unset - it gives up. So TZ is ignored.

或者换句话说为> 5.4.0环境变量TZ从未咨询。

Or in other words for > 5.4.0 the environment variable TZ is never consulted.

有关5.4.0之前 - 如果没有默认的ini设置/征求议会的意见。参见准确的顺序和细节上面的网址。

For 5.4.0 and before - it is consulted when no default/ini is set. See the above URL for exact order and details.

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

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