2014-07-06 58 views
-5

当我使用这个脚本:PHP显示当前日期服务器的/时间

<?php 
print strftime('%c'); 
?> 

我得到

Warning: strftime(): 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 /usr/local/www/apache22/data/virtual/midterm/boballo.php on line 3 
Sun Jul 6 20:41:17 2014 

所有我想表明的是服务器和打印的当前日期/时间它以PHP脚本。我认为服务器(freebsd)会设置时区。如何显示服务器的当前日期并使用php脚本打印?

+4

错误消息告诉你该怎么做。有什么问题? –

回答

5

那么,读什么错误消息告诉你,最重要的部分:

您是需要使用date.timezone设置或date_default_timezone_set()功能。

做到了!