用法
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()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
