我在本地主机上工作时遇到了strtotime问题,但在远程服务器上却没有。
我使用下面的代码来解析每个星期的日期;
$monday = date('Y-m-d', strtotime('monday this week +'.$x.' week'));
$tuesday = date('Y-m-d', strtotime('tuesday this week +'.$x.' week'));
$wednesday = date('Y-m-d', strtotime('wednesday this week +'.$x.' week'));
$thursday = date('Y-m-d', strtotime('thursday this week +'.$x.' week'));
$friday = date('Y-m-d', strtotime('friday this week +'.$x.' week'));
$saturday = date('Y-m-d', strtotime('saturday this week +'.$x.' week'));
$sunday = date('Y-m-d', strtotime('sunday this week +'.$x.' week'));这在localhost中可以正常工作。
在它返回的远程服务器上;
2018-10-22
2018-10-22
2018-10-22
2018-10-22
2018-10-22
2018-10-22
2018-10-28因此,它正在解析周一和周日的正确日期。每隔一天解析与星期一相同的日期。
发布于 2018-10-29 05:36:53
服务器运行的是php版本5.6。已通过安装7.1版解决此问题。
https://stackoverflow.com/questions/53030011
复制相似问题