我正在使用 Ubuntu 12.10,最近安装了 xampp 1.8.1。我的问题是:无法显示来自服务器的图像,如下图所示:
看这里是在我使用的地址栏中本地主机/madeTemplet/basicTemplet/templet03.html 我想在 之后显示图像无名英雄 文本,但它只显示了一些链接而不是任何图像。
我将以下代码用于图像::
<div class="sideBlock unSung">
<h4>Unsung heroes...</h4>
<a href="#"> <img src="_images/1_full.jpg" alt="Midnight Run" width="99" height="135" /> </a>
<a href="#"><img src="_images/2d7y3ki.jpg" alt="Wyatt Earp" width="99" height="135" /></a>
</div>
但是当我使用以下内容时:
看这里是在我使用的地址栏中 file:///opt/lampp/htdocs/madeTemplet/basicTemplet/templet03.html 和图像显示在 之后无名英雄 文本。
检查访问图像所在目录的权限后,我在终端窗口中获得此文本::
sabbir@sabbir-pc:/opt/lampp/htdocs/madeTemplet/basicTemplet/_images$ ls -l
total 300
-rw------- 1 sabbir sabbir 204067 Feb 24 2010 1_full.jpg
-rw------- 1 sabbir sabbir 75789 Nov 13 2009 2d7y3ki.jpg
-rw------- 1 sabbir sabbir 23692 Apr 21 2010 6AB32AE44600435B9DE0FB5EBA24A912.gif
最佳答案
您可能正在使用 file:///
用于寻址 HTML 页面内的图像的路径。不要那样做;使用与服务页面相同的协议(protocol)和主机名,即。 http://localhost
.
出于安全原因,对本地 (file://
) 路径的访问通常在浏览器内部受到限制。
关于php - 在 ubuntu 12.10 的 htdocs 中看不到图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16178342/