4
我想弄清楚如何获取父函数的名称和参数。父函数的名称和参数
实施例:
function foo($a,$b){
bar();
}
function bar(){
// Magic Print
}
foo('hello', 'world');
输出:
foo('hello','world')
任何提示吗?
我想弄清楚如何获取父函数的名称和参数。父函数的名称和参数
实施例:
function foo($a,$b){
bar();
}
function bar(){
// Magic Print
}
foo('hello', 'world');
输出:
foo('hello','world')
任何提示吗?
您可以从debug_backtrace()获取信息。
function bar(){
$backtrace = debug_backtrace();
$t = $backtrace[1];
print $t["function"] . "('" . implode("','", $t["args"]) . "')\n";
}
谢谢。这就是我会做的,但我的头已经开始变得沉重,有时间休息。我会接受你的回答,但是有时间限制! – zaf 2010-05-11 15:08:05
非常方便的错误功能! – botenvouwer 2013-04-20 20:48:28