我在php核心项目中使用include或include_once
include('test1/footer.php');
这是工作在根文件夹..
但是我们在诸如name test2之类的任意文件夹中使用上述代码,并在test2中包含test1文件,此处上述代码不起作用。include('test1/footer.php');
请帮我 。
谢谢..
文件夹结构
/root
/test1
footer.php
index.php
index.php
//works fine because test1 is on the same level as index.php
include('test1/footer.php');
文件夹结构
/root
/test1
footer.php
/test2
index.php
index.php
//does not work since in our current folder there is no folder "test1"
include('test1/footer.php');
//does work since we go back to root first
include('../test1/footer.php');
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句