2015-03-08 150 views
-1

我目前正在尝试使用相对路径显示图像,但它不工作!我尝试的路径是:相对路径不显示的图像

pictures/picture.png 

然而它总是说图像不存在。然后,我甚至会尝试:

sitename/profiles/pictures/picture.png 

仍然不起作用。然后我终于尝试:

http://localhost/sitename/profiles/pictures/picture.png 

它终于起作用了。我试图像这样显示:

<img src="pictures/picture.png" /> 

为什么相对路径不能工作?请帮忙!!! :(

UPDATE 这里是我的directorys:

Sitename 
    Profiles 
    Pictures 
     image.png 
    ProfilesPicture <--- Where I want to run the image 
+0

在工作路径有一个文件夹'型材/'。你必须把它包含到相对路径中。 – emmanuel 2015-03-08 22:03:04

+0

不起作用:( – 2015-03-08 22:03:50

+0

这是您使用该图像的页面的URL? – Oriol 2015-03-08 22:05:51

回答

0

后,大家似乎在帮助我,特别是@Afshin,我能解决我的问题:)正确的SRC是..! /pictures/picture.png。我通过在浏览器中复制图像位置发现了这一点! :d

-1

这应该做的伎俩

<img src="http://localhost/sitename/profiles/pictures/picture.png">