时间:2021-07-01 10:21:17 帮助过:5人阅读
b.php(与根目录同一级)
根目录/a.php
根目录/c.php
根目录/dir/d.php
现在a.php中要包含b.php、c.php。写法如下:
include_once(dirname(__file__)."/../b.php"); include_once(dirname(__file__)."/c.php"); ?> |
include_once(dirname(__file__)."/dir/d.php"); ?> |
http://www.bkjia.com/PHPjc/371453.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/371453.htmlTechArticle用include或requice包含文件时,文件路径前都加上dirname(__file__)。例如:现有a.php、b.php、c.php、d.php4个文件,他们关系为: b.php(与根目录同一...