在file.php:
call()...
Run Code Online (Sandbox Code Playgroud)
如何获得file.php内部的绝对路径call()?
注意call()可能在另一个文件中定义.
another.php:
function call(){..}
Run Code Online (Sandbox Code Playgroud)
file.php:
include(path_to_another.php);
call();
Run Code Online (Sandbox Code Playgroud)
use*_*291 10
没有办法除了debug_backtrace
function whatever() {
$t = debug_backtrace();
echo "called from {$t[0]['file']}";
}
Run Code Online (Sandbox Code Playgroud)