Wampserver - 页面显示方式因我的访问方式而异? [英] Wampserver - page is displaying differently depending on how I visit it?

查看:22
本文介绍了Wampserver - 页面显示方式因我的访问方式而异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了习惯使用服务器软件(并使测试 PHP 脚本更容易),我想我会自己托管一个网站.我成功安装了 Wampserver,我可以通过转到 file:///C:/wamp/www/site/index.php 或 127.0.0.1/site/index.php 来访问该页面.转到前者显示我想要的页面;http://i49.tinypic.com/19xqn6.png.但是当我在后者访问它时,它显示不同(登录"通知向下移动);http://i49.tinypic.com/sy9feg.png.为什么显示不同?

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?

谢谢!

推荐答案

如果您使用 file:///C: 您将不会在服务器环境中运行.这意味着任何服务器端代码都不起作用(例如 PHP 代码).您想使用 127.0.0.1/sitelocalhost/site.

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.

当您使用 file:///C: 时,您的所有 html 和 javascript 都会正确显示,因为这是在客户端完成的.任何应该在服务器端运行的东西,比如 php 都不会执行.

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.

这篇关于Wampserver - 页面显示方式因我的访问方式而异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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