------------------------------------ ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;;[Date] ; Defines the default timezone used by the date functions date.timezone = Asia/Shanghai [Syslog] ; Whether or not to define the various syslog variables (e.g. $LOG_PID, ; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In ; runtime, you can define these variables by calling define_syslog_variables(). define_syslog_variables = Off----------------重启了服务,好像还不行...
相关设置是修改php.ini中的 date.timezone 参数: [Date] ; Defines the default timezone used by the date functions ;date.timezone =默认是关闭的,只需把注释去掉,改为即可 [Date] ; Defines the default timezone used by the date functions date.timezone = PRC其中PRC是“中华人民共和国”!
{
date_default_timezone_set("Asia/Shanghai");
}
echo "当前时间:".date("Y-m-d H:i:s",time());
打印出来的是GMT时间
中国的时区是GMT+8
开始默认是格林尼治时间...
你要设置成PRC就是中国时间.
data.timezone=PRC
跟你操作系统的时区设置没有任何关系,要在PHP里设置,二楼已经给出代码了,或者改php.ini也行。
------------------------------------
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;[Date]
; Defines the default timezone used by the date functions
date.timezone = Asia/Shanghai [Syslog]
; Whether or not to define the various syslog variables (e.g. $LOG_PID,
; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In
; runtime, you can define these variables by calling define_syslog_variables().
define_syslog_variables = Off----------------重启了服务,好像还不行...
[Date]
; Defines the default timezone used by the date functions
;date.timezone =默认是关闭的,只需把注释去掉,改为即可
[Date]
; Defines the default timezone used by the date functions
date.timezone = PRC其中PRC是“中华人民共和国”!
date_default_timezone_set('PRC');
当然最方便的还是程序设置...
不用理会php.ini的配置...
date("Y-m-d H:i:s",time()+8*3600)