搭建PHP环境时在htdocs目录下建立了一个index.php文件
<?php
echo date("Y:m:d H:i:s");
?>
访问时出现警告:
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\Program Files\Apache24\htdocs\index.php on line 2
2017:12:27 13:37:22
是因为没有配置时区,只要在php.ini配置文件中把原来的
;date.timezone =
改成
date.timezone = Asia/Shanghai
注意删除行首的分号
完~