我正在尝试在 ubuntu 上包含文件,但我遇到了一个奇怪的问题。包含文件位于此路径中 - /var/www/cms-dev/corefiles/classes/config.hp 我要包含的文件是此文件 - /var/www/cms-dev/corefiles/lang.php
出于某种原因,在尝试包含它时,它说该文件不存在 -
Warning: require_once(../lang.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/cms-dev/corefiles/classes/config.php on line 9
所以为了寻找解决方案,我使用 scandir 扫描当前目录和上层目录。
对于当前目录,我使用 scandir("./") -
数组 ( [0] => . [1] => .. [2] => .htaccess [3] => admin [4] => ckeditor [5] => corefiles [6] => index.php [7 ] => install.php [8] => log.txt)
对于使用 scandir("/") 的当前目录,我得到了这个 -
数组 ( [0] => . [1] => .. [2] => bin [3] => boot [4] => cdrom [5] => dev [6] => etc [7] => home [8] => 主机 [9] => initrd.img [10] => initrd.img.old [11] => lib [12] => lib64 [13] => lost+found [14] => media [15] => mnt [16] => opt [17] => proc [18] => root [19] => run [20] => sbin [21] => selinux [22] => srv [ 23] => sys [24] => tmp [25] => usr [26] => var [27] => vmlinuz [28] => vmlinuz.old)
为了使用 scandir("../") 扫描上层目录,我得到了这个 -
数组 ( [0] => . [1] => .. [2] => cms-dev [3] => index.html [4] => info.php [5] => test.txt [6] => test.txt~)
但是 config.php 存在于 /var/www/cms-dev/corefiles/classes/config.php 我在这里包含它 - index.php 和这里 urlHandler.php ,但是 config.php 不应该包含相对于他自己的文件吗?