Php debugging tool debug_print_backtrace ()

Source: Internet
Author: User
Debug_print_backtrace () is a very low-key function, which is rarely noticed. however, when an error occurs when I call another object to call another object and a function in another object or file, it is smiling. if we want to know who calls a method? Debug_print_backtrace
Debug_print_backtrace () can print out the call process of a page, from where to see clearly.
However, this is a PHP5 proprietary function. Fortunately, it has been implemented in pear,
Http://pear.php.net/package/PHP_Compat

Test Code
Copy codeThe code is as follows:
Class {
Function say ($ msg ){
Echo "msg:". $ msg;
Echo"
"; Debug_print_backtrace ();
}
}

Class B {
Function say ($ msg ){
$ A = new ();
$ A-> say ($ msg );
}
}

Class c {
Function _ construct ($ msg ){
$ B = new B ();
$ B-> say ($ msg );
}
}

$ C = new c ("test ");

Output result
Copy codeThe code is as follows:
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]

Related links

Http://ch2.php.net/manual/zh/function.debug-print-backtrace.php
Http://ch2.php.net/manual/zh/function.debug-backtrace.php

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.