首页 > 代码库 > PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings.

PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings.

有三种解决办法:


1. php文件中设置时区

    <?php

         date_default_timezone_set(‘Asia/Shanghai‘);

         echo strtotime(‘2012-9-3‘);

    ?>

2. 设置php.ini

   data.timezone = "Asia/Shanghai"


3. 设置date_timezone.ini

  date.timezone = "Asia/Shanghai"


如果使用zend server ,在 Server Setup -> Directives -> date.timezone 设置成Asia/Shanghai 。
然后点击Save Changes, Restart PHP


对应的时区参考:timezones

PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings.