关于php的问题.

来源:百度知道 编辑:UC知道 时间:2024/05/27 23:56:57
高手请看这段代码:
<html>
<body>
<?php
$currtime=time();
$currtimestr=strftime("%H: %M: %S", $currtime); //格式化
echo "当前时间是:" .$currtimestr;
?>
</body>
</html>

我的系统时间明明是:23:08:15但是这段代码运行后却是15:08:15后面分钟和秒都对.可是为什么这个小时却不对呀.请高手帮忙呀.谢谢!

这样处理,修改PHP.INI,查找timezone,修改为如下内容:

[Date]
; Defines the default timezone used by the date functions
date.timezone = Asia/Chongqing

date.timezone = PRC
然后重启apache就ok了