is the time of computer and localhost same?

旧巷老猫 提交于 2019-12-13 07:58:57

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/27721628/is-the-time-of-computer-and-localhost-same

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!