为什么 localhost 不同于直接打开文件
Why is localhost different than opening files directly
目前正在 MAC Yosemite 上工作并尝试测试我在 XAMPP(最新版本)和 Sublime Text 上开发的网站。刚刚从互联网上下载了一张图片并保存到我的 htdocs 文件中。当我将 index.html 提交到我的 url 进行测试时,该图像没有显示。但是,当我打开同一个文件时:
file:///Applications/XAMPP/xamppfiles/htdocs/index.html
图像显示完美?这是代码:
<form method="get" action="/search" id="search">
<input name="q" type="text" size="40" placeholder="Browse" />
</form>
#search input[type="text"] {
background: url(search-white.png) no-repeat 10px 6px #fcfcfc;
border: 1px solid #d1d1d1;
font: bold 12px Arial,Helvetica,Sans-serif;
color: #bebebe;
width: 150px;
padding: 6px 15px 6px 35px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
它看起来与
中的测试有什么不同吗?
file:///Applications/XAMPP/xamppfiles/htdocs/index.html
比localhost/index.html
这是什么原因造成的?
设置权限以便网络服务器可以读取图像。
目前正在 MAC Yosemite 上工作并尝试测试我在 XAMPP(最新版本)和 Sublime Text 上开发的网站。刚刚从互联网上下载了一张图片并保存到我的 htdocs 文件中。当我将 index.html 提交到我的 url 进行测试时,该图像没有显示。但是,当我打开同一个文件时:
file:///Applications/XAMPP/xamppfiles/htdocs/index.html
图像显示完美?这是代码:
<form method="get" action="/search" id="search">
<input name="q" type="text" size="40" placeholder="Browse" />
</form>
#search input[type="text"] {
background: url(search-white.png) no-repeat 10px 6px #fcfcfc;
border: 1px solid #d1d1d1;
font: bold 12px Arial,Helvetica,Sans-serif;
color: #bebebe;
width: 150px;
padding: 6px 15px 6px 35px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
它看起来与
中的测试有什么不同吗?file:///Applications/XAMPP/xamppfiles/htdocs/index.html
比localhost/index.html 这是什么原因造成的?
设置权限以便网络服务器可以读取图像。