怎么在PHP中实现堆栈调试操作?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
$statcks = debug_backtrace(); $tmp_arr = array(); if(!$stacks) return $tmp_arr; foreach($stacks as $k=>$v) { $tmp[$k]['file'] = isset($v['file']) ? $v['file'] : '--'; $tmp[$k]['line'] = isset($v['line'])? $v['line'] : '--'; $tmp[$k]['function'] = isset($v['function']) ? $v['function'] : '--'; }
运行结果:
Array
(
[0] => Array
(
[file] => D:\wwwroot\CodeIgniter\application\controllers\finance\channel.php
[line] => 128
[function] => get_total_rows
)
[1] => Array
(
[file] => --
[line] => --
[function] => index
)
[2] => Array
(
[file] => D:\wwwroot\CodeIgniter\application\controllers\finance\channel.php
[line] => 46
[function] => call_user_func
)
[3] => Array
(
[file] => --
[line] => --
[function] => get_nav
)
[4] => Array
(
[file] => D:\wwwroot\CodeIgniter\system\core\CodeIgniter.php
[line] => 360
[function] => call_user_func_array
)
[5] => Array
(
[file] => D:\wwwroot\CodeIgniter\index.php
[line] => 205
[function] => require_once
)
)
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联网站建设公司,的支持。