use*_*729 8 php relative-path include
这很奇怪,有没有人总结过一个结论呢?
有时它也会检查包含文件的目录.
但有时候不是.
d:\测试\ 1.PHP
<?php
include('sub\2.php');
Run Code Online (Sandbox Code Playgroud)
d:\测试\ 2.PHP
<?php
include('3.php');
Run Code Online (Sandbox Code Playgroud)
3.php同一个目录在哪里2.php.
上面的工作,但为什么?当前目录应该是D:\test,但它仍然可以找到3.php,这是在D:\test\sub
更多故事(最终)
大约一年前我遇到了这个问题,然后我最终用下面的硬编码修复了它:
的common.php:
if (file_exists("../../../Common/PHP/Config.inc"))
include('../../../Common/PHP/Config.inc');
if (file_exists("../../Common/PHP/Config.inc"))
include('../../Common/PHP/Config.inc');
if (file_exists("../Common/PHP/Config.inc"))
include('../Common/PHP/Config.inc');
if (file_exists("Common/PHP/Config.inc"))
include('Common/PHP/Config.inc');
Run Code Online (Sandbox Code Playgroud)
凡Config.inc在同一目录Common.php