Definition and Usage
The PHP debug_backtrace () function generates a backtrace (backtracking information).
The function returns an associative array. The following are the elements that might be returned:
Name |
Type |
Describe |
function |
String |
The current function name. |
Line |
Integer |
The current line number. |
File |
String |
The current file name. |
Class |
String |
The current class name |
Object |
Object |
The current object. |
Type |
String |
The current invocation type, which may be called:
|
Args |
Array |
If the function parameter is listed in the function. If in the referenced file, list the referenced file name. |
Grammar
Debug_backtrace ()
Example
<?phpfunction One ($str 1, $str 2) {One ("Glenn", "quagmire");} function ($str 1, $str 2) {Three ("Cleveland", "Brown");} Function three ($str 1, $str 2) {Print_r (Debug_backtrace ());} One ("Peter", "Griffin");
Output:
Array ( [0] = = Array ( [File] = D:\PHP\xampp\htdocs\52php\123\789.php [line] + = 7 [ Function] = three [args]/= Array ( [0] = Cleveland [1] = Brown ) ) [1] =& Gt Array ( [File] = D:\PHP\xampp\htdocs\52php\123\789.php [line] = 3 [function] = [args] = Array ( [0] = Glenn [1] = Quagmire ) ) [2] = = Array ( [File] = D:\PHP\ xampp\htdocs\52php\123\789.php [Line] = [ function] = one [args] + Array ( [0 ] = Peter [1] = Griffin)) )
Debug_backtrace function Understanding 1
The Debug_backtrace function is to generate a backtrace.
The Debug_backtrace function returns an associative array.
1.backtrace how to understand;
2. Whether the associative array can be understood as being able to relate the new array to the original array;
Debug_backtrace Function Understanding 2
Parameters of the Debug_backtrace function
Functions: The current function name.
1. Whether the current function name is a custom function or a system function;
Line: The current row number.
Whether 1.line can be understood as the number of rows where the function is called;
File: the current filename.
1.file can be understood as the file where the current debugging is located
Class: The current category name
Object: The current object.
Type: The current invocation type, possibly called:
return: "--"-Method call
Return: "::"-static method call
Return Nothing-function call
1. How the invocation of various methods is understood;
Args[] Array If the function parameter is listed in the function. If in the referenced file, list the referenced file name.
Debug_backtrace function Understanding 3
<?php function One ($str 1, $str 2) {One ( "Glenn", "quagmire"), and function one ($str 1, $str 2) { three (" Cleveland "," Brown "); } Function three ($str 1, $str 2) { Print_r (Debug_backtrace ()); } One ("Peter", "Griffin");?>
Output:
Array ([0] = = Array ([file] = = C:\wamp\www\web.php [line] = [function] = three [args] = Array ([0] = Cleveland [1] = Brown)) [1] = = Array ([file] = C:\wamp\www\web.php [line] [] [function] = wo [args] = Array ([0] = Glenn [1] = quagmire)) [2] = = Array ([file] + C:\wamp\www\web.php [line] = > 94 [function] = one [args] = Array ([0] = Peter [1] = Griffin)))