php日期问题

<?php
echo "今天是 " . date("Y/m/d") . "<br>";

?>
出现这个是什么原因

clipboard.png
Strict Standards: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in F:appappserverAppServwwwdate1.php on line 7
浠婂ぉ鏄� 2016/11/08

阅读 3k
5 个回答

在使用之前设置时区。

时区没有设置,更改一下php.ini文件中的date.timezone = PRC ,进行如上的更改,然后重启一下服务器

date_default_timezone_set('PRC');

修改php.ini的配置项data.timezone = "Asia/Shanghai"。或者如下

<?php
date_default_timezone_set('Asia/Shanghai');
echo "今天是 " . date("Y/m/d") . "<br>";
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题