是否可以自动记录函数的每次输入


Is it possible to automatically log every enter to a function?

PHP中是否有任何开关可以记录输入的每个函数?我的意思是,手动版本:

function foo()
{
  echo "function foo entered.'n";
  ...
}

当然,我想将此echo"添加"为开关,并由PHP处理开关。可能吗?

看看 xdebug & xdebug_start_function_monitor()

我想你正在寻找debug_print_backtrace();

您可以在此处找到示例:http://php.net/manual/en/function.debug-print-backtrace.php