Principle:
1. During the execution of the program, record the variables you want to track, the call stack and the parameters of each function call in the corresponding places.
Record this information in a certain format. File, one variable per line, please refer to the code for the specific data format, I will not go into details here.
2. Now there is all the information (including call stack and parameters) every time the variable is recorded. When you log in through the browser When accessing this program, this program will read and analyze the entire file,
display all your debugging information on the page, and it will dynamically refresh ajax to keep synchronized with your debugging.
Draw a picture Well, it’s much clearer.
BackTrace is the call stack information, which is not reflected in the picture. It is dynamically refreshed by ajax.
Function:
Cut again Here are a few local diagrams:
1. Include files, debugging variables (the above is the program, the bottom is the debugging output of apache_request_headers())
2. Call stack list of a certain function in the drupal system
3. Call parameters of a function in the stack
Postscript:
The program basically implements the functions of debugging and tracking PHP variables, and also comes with a call stack and call parameters View function.
Nowadays, I rarely use echo, print_r, var_dump and other system functions unless necessary to debug output. Basically, you can get what you want with this.
Especially for complex systems like drupal, you can clearly know how the program is executed.
Explanation:
The program is written in php4. It has been tested on php4.4.8 and 5.2.5, and it theoretically supports php4 and php5.
It has also been tested on linux, window, ie6-7, and firefox, but I still cannot guarantee that it will work in your environment. There are no errors when downloading. If there are any, please correct them yourself.
Please do not let the log file exceed 5M in size, as the browser may crash.
Download address http://www.jb51.net/codes/ 20851.html
http://www.bkjia.com/PHPjc/320486.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320486.htmlTechArticlePrinciple: 1. During the execution of the program, record the variables and call stacks you want to track in the corresponding places And the parameters of each function call, record this information to a file in a certain format, a...