我有以下文件结构:PHP需要()相对路径错误
rootDIR dir1 subdir1 file0.php file1.php dir2 file2.php file3.php file4.php
file1.php
需要来自DIR2这样file3的和文件4:
require('../../dir2/file3.php')
file2.php
要求file1.php
这样的:
require('../dir1/subdir1/file1.php')
但之后在file1中要求无法打开文件3和文件4(可能是由于路径亲戚关系)
但究竟是什么原因,什么能为file2.php
我这样做file1.php
正常需要文件3和文件4
http://stackoverflow.com/questions/11383960/how-to-refer-back-to-public-html-root-file-using-include-after-going-up-one-file在这里你可以找到明确的解释。 –