可能重复:
PHP - retrieve name of script that included or required it
PHP
是否有办法获取当前文件的文件required/included
?例如:
<?php
include("add-person.php");
?>
<?php
echo get_parent(); //should return controller.php
?>
php -f controller.php
基本上就像伪造的函数get_parent()
。感谢。