我试图在我的PHP文件中做一些包含。我试图包含的两个文件都存在。
这个有效:
include("/folder/subfolder/firstfile.php");
这个没有:
include("/folder/secondfile.php");
这怎么可能,因为两个包括来自同一文件夹.....?
我遇到的错误
Warning: include(/folder/secondfile.php) [function.include]: failed to open stream: No such file or directory in index.php on line 2
Warning: include() [function.include]: Failed opening '/folder/secondfile.php' for inclusion (include_path='.:/usr/local/lib/php') in index.php on line 2
文件结构
Root中包含folder
。包含文件位于根目录中的另一个文件夹中。
答案 0 :(得分:0)
第二个include()
中缺少PHP扩展名。
include("/folder/secondfile");
更改为
include("/folder/secondfile.php");
还要确保它位于文件夹folder
中。如果它在subfolder
中,请不要忘记将其包含在以下路径中:
include("/folder/subfolder/secondfile.php");