2014-07-06 89 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()功能。

做到了!