Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我决定将我的网站组织到文件夹中,问题是当我这样做时,PHP 文件无法访问根目录中的 /Images。例如:我有一个 header.php 链接到 /test_folder/test.php 并包含。这些文件都不能访问 /Images 文件夹。有没有一种解决方案可以让我将文件组织到文件夹中,并且仍然可以访问根目录中的主文件?
请记住,路径名中的初始斜杠将指向文件系统的根目录。尝试以下方法之一:
include($_SERVER["DOCUMENT_ROOT"]. "/test_folder/test.php");
如果您知道相对路径,则为:
include("../test_folder/test.php");