和本地主机的时间相同吗? [英] is the time of computer and localhost same?

查看:108
本文介绍了和本地主机的时间相同吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机中有一个Xampp.当我尝试在我的php文件中回显时:

I have a xampp in my computer. When I try to echo in my php files like:

$time=strtotime("now");
echo $time;

这使我的时间与计算机的时间有所不同.回声给我的时间比我的计算机时间早两个小时.

It gets me diffrent time than my computer's time. The time echo gives me is about two hours earlier than my computer's time.

如何确定本地服务器的时间. 谢谢

How can I fix the time of my local server. Thanks

推荐答案

http://php.net/manual/en/function.strtotime.php :此函数的每个参数都使用默认时区,除非在该参数中指定了时区.请注意不要在每个参数中使用不同的时区除非打算这样做.有关定义默认时区的各种方法,请参见date_default_timezone_get()."

http://php.net/manual/en/function.strtotime.php: "Each parameter of this function uses the default time zone unless a time zone is specified in that parameter. Be careful not to use different time zones in each parameter unless that is intended. See date_default_timezone_get() on the various ways to define the default time zone."

可能是时区问题,请参见上面的链接以获取完整文档.

Probably a timezone problem, see above link for complete documentation.

这篇关于和本地主机的时间相同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆