我有一个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