这篇文章主要介绍了关于php bug 调试助手 debug_print_backtrace()的介绍,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
debug_print_backtrace() 是一个很低调的函数,很少有人注意过它. 不过当我对着一个对象调用另一个对象再调用其它的对象和文件中的一个函数出错时,它也许正在一边笑呢
如果我们想知道某个方法被谁调用了? debug_print_backtrace可以解决
debug_print_backtrace() 可以打印出一个页面的调用过程 , 从哪儿来到哪儿去一目了然.
不过这是一个PHP5的专有函数,好在pear中已经有了实现,
案例1
<?php
class a{
function say($msg) {
echo "msg:".$msg;
echo "<pre>";debug_print_backtrace();
}
}
class b {
function say($msg) {
$a = new a();
$a->say($msg);
}
}
class c {
function __construct($msg) {
$b = new b();
$b->say($msg);
}
}
$c = new c("test");立即学习“PHP免费学习笔记(深入)”;
案例2
<?php
function one($str1, $str2)
{
two("Glenn", "Quagmire");
}
function two($str1, $str2)
{
three("Cleveland", "Brown");
}
function three($str1, $str2)
{
echo '<pre>';
debug_backtrace();
}
echo one('a','b');?>立即学习“PHP免费学习笔记(深入)”;
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!
相关推荐:
php 的http_build_query stream_context_create post请求
以上就是php bug 调试助手 debug_print_backtrace()的介绍的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号