PHP-打印调用函数入口地址(堆栈)-方便调式.php
<?php
// 此函数可以打印出 当前所在函数被哪些函数调用
function print_stack_trace()
{
$html = "";
$array = debug_backtrace();
unset($array[0]);
foreach($array as $row)
{
$html .=$row['file'].':'.$row['line'].'行,调用方法:'.$row['function']."<p>";
}
echo $html;
}
//这是更简洁的方式
$e = new Exception;
var_dump($e->getTraceAsString());