我有一個html文件images.html,顯示子目錄「img」中的圖像。它使用相對路徑訪問subdir中的圖像。php:包含文件中的相對路徑
事事不順心的時候,我的index.php我做的:
require_once("dir1/dir2/images.html");
現在的相對路徑是相對於我的index.php,而不是DIR1/DIR2/images.html,我看不到我的圖片。有沒有辦法讓我的路徑相對於包含文件images.html?
目錄結構
index.php
dir1
dir2
images.html
img
flower.png
的index.php
<?php require_once("dir1/dir2/images.html"); ?>
images.html
<img src="img/flower.png" />
PHP的內部工作不影響瀏覽器中加載圖像的方式。顯示更多信息:您的'
'標籤有哪些路徑,它們位於何處? –
2013-02-15 12:11:26