为什么我没有得到相同的结果?
Why I don't get the same result?
我 运行 在不同的服务器上使用相同的代码,但我没有得到相同的结果。
https://imgur.com/a/xUAhvNY
<?php
echo date('Y-m-d H:i:s', strtotime("+20 year"));
echo "<br>PHP version: ".phpversion();
?>
在脚本开头添加;
date_default_timezone_set('Europe/Amsterdam');
这与时区无关,但与时间戳存储为 32 位数字的系统上的 limitation of the UNIX timestamp 有关。左边的服务器可能受到问题的影响。
来自 strftime 页面的注释:
The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.)
[...]
For 64-bit versions of PHP, the valid range of a timestamp is effectively infinite, as 64 bits can represent approximately 293 billion years in either direction.
我 运行 在不同的服务器上使用相同的代码,但我没有得到相同的结果。 https://imgur.com/a/xUAhvNY
<?php
echo date('Y-m-d H:i:s', strtotime("+20 year"));
echo "<br>PHP version: ".phpversion();
?>
在脚本开头添加;
date_default_timezone_set('Europe/Amsterdam');
这与时区无关,但与时间戳存储为 32 位数字的系统上的 limitation of the UNIX timestamp 有关。左边的服务器可能受到问题的影响。
来自 strftime 页面的注释:
The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.)
[...]
For 64-bit versions of PHP, the valid range of a timestamp is effectively infinite, as 64 bits can represent approximately 293 billion years in either direction.