我试图使我的PHP脚本动态地包括。这是我的目录树:冲突包括具有相对路径的文件
-index.php
-sources/
--hello.php
--bye.php
在我index.php
我做一个包括hello.php的:
include("sources/hello.php");
在我hello.php
我还有另外包括:
include("bye.php");
当我访问index.php
它会抛出一个错误说:
消息: require_once(bye.php)一次function.require] :未能打开流:没有这样的文件或目录
有没有办法得到它的工作原理,但没有绝对的路径?由于路径可以是可变的从一个目录到另一个但保持结构:
-index.php
-sources/
--hello.php
--bye.php
那是我一直在寻找的!非常感谢 :) – manix