中山php|最优网络 :中山做网站 中山php建站
最优良人
Posts Tagged With: date
php date函数的时区问题,输出时间有误
2012/06/02 at 10:16 » Comments (15)
问题:echo date('o-m-j H:i'); 输出结果与本地时间相差8小时。 原因:时区未正确设置。 两种解决方法: 1.加入date_default_timezone_set('Asia/Shanghai'); 2. 修改php.ini [Date] ; Defines the default timezone used by the date functions date.timezone = PRC 注:PRC为中化人民共和国 more »