php-在根文件夹之外包含html页面

在我的php网站上,我试图将html页面包含在根文件夹之外(html页面会自动更改) 如果我包含html页面,则链接文件会出现404错误,如果我也包含链接文件,它们将无法正确显示 路径/站点/根目录/index.php

...
include("path/html/index1.html");
include("path/html/index1_files/img.png");
...

路径/html/index1.html

...
<img src="index1_files/img.png">
...


result: enter image description here

评论
  • Dear
    Dear 回复

    You need to specify the directory properly. So, in your case, when linking to the image, replace <img src="index1_files/img.png"> with <img src="./index1_files/img.png">. The ./ goes back one level. Your code is looking for a folder called index1_files within the current page.