可能重复:
Caller function in PHP 5?
php: determine where function was called from
让我们说
function item_description(){
$var = 6;
description($var);
}
function item_description_extended(){
$var = 7;
description($var);
}
function description(){
if(called_from_item_description){
echo 6;
}else{
echo 7;
}
}
我知道这些功能毫无意义......但我的问题是,如果我能知道叫descrption()
的方法是什么?
答案 0 :(得分:2)
http://us2.php.net/manual/en/function.debug-backtrace.php
debug_backtrace
会告诉谁给你打电话