Wampserver - page is displaying differently depend

2019-08-21 09:24发布

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条回答
女痞
2楼-- · 2019-08-21 10:06

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.

查看更多
登录 后发表回答