This article mainly introduces the debugging information about the debug_backtrace() function print call in PHP. It has a certain reference value. Now I share it with you. Friends in need can refer to it
(PHP 4 >= 4.3.0, PHP 5, PHP 7)
debug_backtrace —Generate a backtrace
##arraydebug_backtrace ([int$options= DEBUG_BACKTRACE_PROVIDE_OBJECT [,int$limit
= 0 ]] )
Parameters
Whether to fill in "object" index. | |
Whether to ignore the index of "args", including all function/method parameters, can save memory overhead. |
orFALSE
, which were respectively equal to whether to setDEBUG_BACKTRACE_PROVIDE_OBJECT
option.
=0
), which returns all stack frames.
Elements that may be returned from
Type | Description | |
---|---|---|
string | The current function name, see: __FUNCTION__. | |
integer | The current line number. See: __LINE__. | |
string | The current file name. See: __FILE__. | |
string | The name of the current class. See __CLASS__ | |
object | the current object. | |
string | The type of the current call. If it is a method, "->" will be returned. If it is a static method, "::" will be returned. If it is a function call, returns null. | |
array | If inside a function, this will list the parameters of the function. If it is in an included file, the included file name will be listed. |
Example #1debug_backtrace() Example
Execution The result returned is similar to the following:
Hi: friend array(2) { [0]=> array(4) { ["file"] => string(10) "/tmp/a.php" ["line"] => int(10) ["function"] => string(6) "a_test" ["args"]=> array(1) { [0] => &string(6) "friend" } } [1]=> array(4) { ["file"] => string(10) "/tmp/b.php" ["line"] => int(2) ["args"] => array(1) { [0] => string(10) "/tmp/a.php" } ["function"] => string(12) "include_once" } }
The above is the entire article Content, I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
About a problem encountered with PHP conditional operators and Solution
Description | |
---|---|
Added optional parameter | limit.
|
The parameter | provide_objectwas changed tooptions , and the optional parameterDEBUG_BACKTRACE_IGNORE_ARGS# was added ##.
| 5.2.5
provide_object | .
| 5.1.1
object as a possible returned element. |
The above is the detailed content of About the debug_backtrace() function in PHP that prints debugging information at the call location. For more information, please follow other related articles on the PHP Chinese website!