可能重复:
PHP - 检索包含或需要它的脚本的名称
有没有办法PHP
获取required/included
当前文件的哪个文件?例如:
控制器.php
<?php
include("add-person.php");
?>
添加人.php
<?php
echo get_parent(); //should return controller.php
?>
执行
php -f controller.php
基本上,类似于虚构的功能get_parent()
。谢谢。