目錄結構:iframe中使用不同的主目錄
htdocs
index.php
cms.php
images/
image.jpg
otherpic.png
content/
home.php
otherfile.php
/content/home.php包含圖像的負荷。這將包括在index.php文件,所以,請注意該SRC只有一個點,因爲裏面的index.php其讀:
<img src="./images/image.jpg"></img>
現在cms.php擁有一個iframe。 iframe應該是富文本編輯器,以便home.php可以被編輯。
這使我想到了以下問題:當我要加載的iframe的圖像源需要有兩個點內home.php,
<img src="../images/image.jpg"></img>
因爲home.php
裏面/content/
這樣的iframe會看到/content/
爲是它的父目錄,不是/htdocs/
。
如何在iframe /文本編輯器和index.php中顯示圖像?
是否有任何理由不能設置路徑從web根目錄開始?即「/images/image.jpg」(沒有小圓點) – sbeliv01
哇是可能的嗎?我認爲./images/image.jpg和/images/image.jpg是一樣的 – user1534664
是的。有可能的。爲了詳細說明這些點,單個點「。」代表當前目錄,「..」代表當前目錄中的一個。最初的'/'可以追溯到webroot。 – sbeliv01