1. 程式人生 > >php執行時遇到的一些問題和解決方案

php執行時遇到的一些問題和解決方案

1.用php指令碼向伺服器請求資料的時候,總是出現一些警告資訊:

PHP Warning:  strtotime(): 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

/data/svc/dataserver/scripts/CDataCache.php on line 1392


原因:時區問題導致。

解決方案:在最開始用到的php指令碼的最前面加上這行程式碼:ini_set('date.timezone','Asia/Shanghai');問題就解決了。