使用 nginx + php-fpm 測試 phpinfo() 時....發現了底下這個warning 訊息...
Warning: phpinfo(): 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 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /var/www/test.php on line 2
查了一下...加上用 date_default_timezone_set()...果然就可以了
引用:
<?php
date_default_timezone_set("Asia/Taipei");
echo strftime("%Y-%m-%d %H:%M:%S");
?>
或是直接修改 /etc/php.ini
將
;date.timezone =
改成
引用:
date.timezone = "Asia/Taipei"
這樣也可以囉 ~~~