且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

php.ini默认时区与date.timezone

更新时间:2023-01-14 21:14:06

date() 依赖 date.timezone INI设置.由于一个是芝加哥(CT),另一个是UTC,所以您的时差是5小时.

date() relies on the date.timezone INI setting. Since one is Chicago (CT) and the other is UTC, that is your 5 hour difference.

我相信自PHP> 5.2起,您应该会收到:

I believe as of PHP > 5.2 you should receive:

PHP警告:未知:依靠系统的时区是不安全的 设置.您需要 使用date.timezone设置或 date_default_timezone_set()函数.

PHP Warning: Unknown: 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.

我鼓励您查看新的 DateTime 对象或按照 SDC 的建议使用UTC.

I would encourage you to look at the new DateTime object or use UTC as advised by SDC.