在php.ini中加上这一段
[Date]
; Defines the default timezone used by the date functions
date.timezone = Asia/Shanghai
重启apache后再看
[Date]
; Defines the default timezone used by the date functions
date.timezone = Asia/Shanghai
重启apache后再看
——不赞成,因为租、买来的虚拟主机或者空间,你未必能去修改这个文件方案2:在程序中养成习惯,在代码中,牵涉到相关语句时,改php文件开头加上ini_set('date.timezone','Asia/Shanghai');
是时区问题,以上是网上找的方法,LZ可以试试看,或者直接在得到时间上面加8小时
再取时间就可以正确了。