添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
力能扛鼎的剪刀  ·  APP_KEY help please - ...·  1 周前    · 
精明的针织衫  ·  PHP: if - Manual·  1 周前    · 
帅气的水桶  ·  2 Requirements·  1 周前    · 
绅士的闹钟  ·  2 Requirements·  1 周前    · 
飘逸的香蕉  ·  EventSource's ...·  1 年前    · 
干练的火锅  ·  view ui ...·  2 年前    · 
仗义的羽毛球  ·  statsmodels.tsa.arima_ ...·  2 年前    · 
激动的警车  ·  Flink Table API & SQL ...·  2 年前    · 
潇洒的野马  ·  CheckBox ...·  2 年前    · 

想當初剛接觸PHP時,其中遇到的一個問題
在抓取系統時間,使用date()函數時出現以下錯誤:
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.

echo date("H:m:s");

經查詢,是php.ini檔的Date未設定時區

假如不想更改php.ini檔案,但需顯示其餘國家的時間,可以在程式碼內部設定
加入以下程式碼:date_default_timezone_set("Asia/Taipei");
(這邊是以台灣為示範)

經過實做,如下程式碼:

date_default_timezone_set("Asia/Taipei"); echo date("H:m:s");

(參考資料: http://www.w3schools.com/php/php\_date.asp )