如果我们想知道某个方法被谁调用了? debug_print_backtrace可以解决
debug_print_backtrace() 可以打印出一个页面的调用过程 , 从哪儿来到哪儿去一目了然.
不过这是一个php5的专有函数,好在pear中已经有了实现,
http://pear.php.net/package/php_compat
测试代码
";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");输出结果
msg:test #0 a->say(test) called at [/var/www/test/test0723.php:12] #1 b->say(test) called at [/var/www/test/test0723.php:19] #2 c->__construct(test) called at [/var/www/test/test0723.php:23]
以上就是php 调试利器debug_print_backtrace()的内容,更多相关内容请关注PHP中文网(www.php.cn)!
系统易学易懂,用户只需会上网、不需学习编程及任何语言,只要使用该系统平台,只要会打字,即可在线直接完成建站所有工作。本程序适合不懂php环境配置的新手用来在本机调试智能SiteSEO网站优化软件,安装过程极其简单。您的网站地址:http://localhost您的网站后台:登录地址: http://localhost/admin.php密 码: admin服务器套件所包含的软件:nginx-0.7









