首页 >php教程 >PHP开发 >PHP debug_backtrace() 堆栈调试

PHP debug_backtrace() 堆栈调试

黄舟
黄舟原创
2016-12-28 13:42:171893浏览

例子

<?php 
function one($str1, $str2) 
{ 
two("Glenn", "Quagmire"); 
} 
function
two($str1, $str2) 
{ 
three("Cleveland", "Brown"); 
} 
function three($str1,$str2) 
{ 
print_r(debug_backtrace()); 
} 
one("Peter", "Griffin"); 
?>

输出:

Array ( [0] => Array ( [file] => C:\webfolder\test.php [line] => 7
[function] => three [args] => Array ( [0] => Cleveland [1] => Brown ) )
[1] => Array ( [file] => C:\webfolder\test.php [line] => 3 [function] =>
two [args] => Array ( [0] => Glenn [1] => Quagmire ) ) [2] => Array (
[file] => C:\webfolder\test.php [line] => 14 [function] => one [args] =>
Array ( [0] => Peter [1] => Griffin ) ) )

 以上就是PHP debug_backtrace() 堆栈调试的内容,更多相关内容请关注PHP中文网(www.php.cn)!


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn