如何更改时间Apache服务器,因此计算机的时间(PHP)相匹配? [英] How to change the time in apache server so it matches the computer's time (PHP)?
问题描述
在我的具体情况,在服务器和客户端在同一台计算机,我在本地主机上。当我从date()函数回声出的日期,它会显示一个完全错误的值,A 11小时前的时间。我也试过gmdate(),但它显示在AM PM没有日期。有什么办法来改变Apache服务器的时间,所以我每次得到它在PHP中,它显示一样在我的电脑上的时间?
In my particular case, both the server and the client are the same computer, I'm on localhost. When i echo out the date from the date() function, it displays a totally wrong value, a 11 hours earlier time. I also tried gmdate(), but it displays the date in AM not PM. Is there any way to change the apache server time, so everytime I get it in php, it displays the same as the time on my computer?
编辑:对不起,我迟到编辑。我已经设置php.ini中的时区,但它仍然无法正常工作。我敢肯定,我的时区是正确的,因为我从手动得到它,从检查的phpinfo()。
Sorry for the late edit. I have already set the timezone in the php.ini but it still doesn't work. And I'm sure that my timezone is correct, since I got it from the manual and checked from phpinfo().
推荐答案
我相信你正在寻找: date_default_timezone_set(字符串$ timezone_identifier)
您还可以设置这个在php.ini配置。
You can also set this in your php.ini config.
这篇关于如何更改时间Apache服务器,因此计算机的时间(PHP)相匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!