php调试利器
发布时间:2022-07-08 11:19 所属栏目:121 来源:互联网
导读:如果我们想知道某个方法被谁调用了? debug_print_backtrace可以解决!~ 测试代码: ?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 { f
如果我们想知道某个方法被谁调用了? debug_print_backtrace可以解决!~ 测试代码: <?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"); 输出结果: 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] (编辑:ASP站长网) |
相关内容
网友评论
推荐文章
热点阅读