PHP - 用require_once/include/require,路径是相对于什么的?

Gal*_*Gal 4 php path

什么时候开始"index.php",我做require_once("/all_fns.php").

"all_fns.php"本身需要具有相对于all_fns.php(本身)的路径的文件.

我的问题是,我应该写all_fns相对于all_fns.php或index.php的路径吗?

这对我来说非常困惑,并希望直截了当.

Pek*_*ica 11

他们被视为相对于index.php.

如果需要引用相对于include的文件,请使用

__DIR__."/relative/file.php";
Run Code Online (Sandbox Code Playgroud)