用法
array debug_backtrace ( void );
定义和用法
它返回一个关联数组。可能的返回元素如下 -
| 名称 | 类型 | 描述 |
|---|---|---|
| function | string | 当前函数名称。 |
| line | integer | 当前行号。 |
| file | string | 当前文件名。 |
| class | string | 当前类名。 |
| object | string | 当前对象。 |
| type | string | 当前调用类型。如果是方法调用,则返回 "->"。如果是静态方法调用,则返回 "::"。如果函数调用,则不返回任何内容。 |
| arg | array | 如果在函数内部,则列出函数参数。如果在包含的文件中,则列出包含的文件名。 |
参数
| Sr.No | 参数及说明 |
|---|---|
| 1 |
void 不适用。 |
返回值
它返回描述中描述的关联数组。
示例
以下是此函数的用法 -
<?php
function printStr($str) {
echo "Hi:$str";
var_dump(debug_backtrace());
}
printStr('hello');
?>
这将产生以下结果 -
Hi:helloarray(1) {
[0]=>
array(4) {
["file"]=> string(36) "/var/www/tutorialspoint/php/test.php"
["line"]=> int(8)
["function"]=> string(8) "printStr"
["args"]=> array(1) {
[0]=>
&string(6) "hello"
}
}
}
相关用法
- PHP debug_backtrace()用法及代码示例
- PHP debug_print_backtrace()用法及代码示例
- PHP debug_zval_dump()用法及代码示例
- PHP decbin()用法及代码示例
- PHP decoct()用法及代码示例
- PHP dechex()用法及代码示例
- PHP deg2rad()用法及代码示例
- PHP decoct( )用法及代码示例
- PHP define()用法及代码示例
- PHP decbin( )用法及代码示例
- PHP defined()用法及代码示例
- PHP dechex( )用法及代码示例
- PHP disk_total_space()用法及代码示例
- PHP disk_total_space( )用法及代码示例
- PHP dir()用法及代码示例
- PHP date_default_timezone_set()用法及代码示例
- PHP date_create_immutable()用法及代码示例
- PHP date_get_last_errors()用法及代码示例
注:本文由纯净天空筛选整理自 PHP - Function debug_backtrace()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
