很少使用PHP5 今天无聊在服务器升级PHP5 发现时间不对劲差8小时在那郁闷了半天还以为是服务器IIS和PHP结合的问题
觉得是配置的问题,打开php.ini,搜索time 不小心搜索到:
[Date]
; Defines the default timezone used by the date functions
;date.timezone =
怀疑是这里的问题
在官方网站上文档找到相关内容,默认date.timezone为utc,在网站上有一个时区对照表:
[url=http://www.php.net/manual/en/timezones.asia.php]http://www.php.net/manual/en/timezones.asia.php[/url]
找到香港就设了个香港时区
[Date]
; Defines the default timezone used by the date functions
date.timezone = Asia/Hong_Kong
保存更新IIS 一切OK