Php debugging tool debug_print_backtrace ()

Source: Internet
Author: User

If we want to know who called 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 codeCopy codeThe Code is as follows: <? Php
Class {
Function say ($ msg ){
Echo "msg:". $ msg;
Echo "<pre>"; 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 resultCopy 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.