Php-function-debug-backtrace
提供:Dev Guides
PHP-関数debug_backtrace()
構文
array debug_backtrace ( void );
定義と使い方
連想配列を返します。 返される可能性のある要素は次のとおりです-
Name | Type | Description |
---|---|---|
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 | string | The current Object. |
type | string | The current call type. If a method call, "→" is returned. If a static method call, "::" is returned. If a function call, nothing is returned. |
arg | array | If inside a function, this lists the functions arguments. If inside an included file, this lists the included file name(s). |
パラメーター
Sr.No | Parameter & Description |
---|---|
1 |
void NA. |
戻り値
説明で説明されている連想配列を返します。
例
以下は、この機能の使用法です-
<?php
function printStr($str) {
echo "Hi: $str";
var_dump(debug_backtrace());
}
printStr('hello');
?>
これは、次の結果を生成します-
Hi: helloarray(1) {
[0]=>
array(4) {
["file"]=> string(36) "/var/www/finddevguides/php/test.php"
["line"]=> int(8)
["function"]=> string(8) "printStr"
["args"]=> array(1) {
[0]=>
&string(6) "hello"
}
}
}