Wampserver - page is displaying differently depending on how I visit it?

我的未来我决定 提交于 2019-12-25 00:24:53

问题


To get used to using server software (and to make it easier to test PHP scripts), I thought I'd host a website myself. I successfully installed Wampserver, and I can visit the page by going to either file:///C:/wamp/www/site/index.php or 127.0.0.1/site/index.php. Going to the former displays the page how I want it; http://i49.tinypic.com/19xqn6.png. But when I visit it at the latter, it displays differently (the "logged in" notice moves down); http://i49.tinypic.com/sy9feg.png. Why does it display differently?

Thanks!


回答1:


If you use file:///C: you won't be running in the server environment. This means any server side code won't work (such as PHP code). You want to use 127.0.0.1/site or localhost/site.

When you use file:///C: all of your html and javascript will be displayed properly, because that's done client side. Anything that is supposed to run server side, such as php won't execute.



来源:https://stackoverflow.com/questions/14803348/wampserver-page-is-displaying-differently-depending-on-how-i-visit-it

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