0

我一直在开发一个小型 Web 应用程序,并且在 IDE 中一切正常,但是第一次将它发送到服务器时,我收到了这个错误:

PHP 致命错误:未捕获的异常 'Exception' 带有消息 'DateTime::__construct():依赖系统的时区设置是不安全的。您需要使用 date.timezone 设置或 date_default_timezone_set() 函数。如果您使用了这些方法中的任何一种,但仍然收到此警告,您很可能拼错了时区标识符。我们在 /home/jhenslee/public_html/simpleWFA/WarframeAlerts.php:49\nStack trace:\n#0 /home/.../public_html/ 中为 'CDT/-5.0/DST' 选择了 'America/Chicago' .../....php(49): DateTime->__construct()\n#1 {main}\n 在/home/.../public_html/.../....php 上线49

问题是我在时间上做了很多事情(例如):

$now = new DateTime();
$rssdate = new DateTime();
$age = new DateInterval("P1D");

$trdate_obj =  $rssdate->createFromFormat(DateTime::RSS, $pubdate);
$age = $now->diff($trdate_obj);
$age_minutes = ($age->h * 60) + ($age->i);
$timeleft = ($lengthnum - $age_minutes);

$msg = $age->h . " hours " . $age->i . " minutes";

其他获得时间的功能/方式是否仍然适用于我所写的所有内容?

谢谢!

4

0 回答 0