2015-03-08 217 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">