PHP debug_backtrace()関数
例
PHPバックトレースを生成します。
<?php
function a($txt) {
b("Glenn");
}
function b($txt) {
c("Cleveland");
}
function c($txt) {
var_dump(debug_backtrace());
}
a("Peter");
?>
定義と使用法
debug_backtrace()関数は、PHPバックトレースを生成します。
この関数は、debug_backtrace()関数に至るまでのコードからのデータを表示します。
連想配列の配列を返します。返される可能性のある要素は次のとおりです。
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 | object | The current object |
type | string | The current call type. Possible calls:
|
args | array | If inside a function, it lists the functions arguments. If inside an included file, it lists the included file names |
構文
debug_backtrace(options, limit);
パラメータ値
Parameter | Description |
---|---|
options | Optional. Specifies a bitmask for the following options: DEBUG_BACKTRACE_PROVIDE_OBJECT (Whether or not to populate the "object" index DEBUG_BACKTRACE_IGNORE_ARGS (Whether or not to omit the "args" index, and all the function/method arguments, to save memory) |
limit | Optional. Limits the number of stack frames printed. By default (limit=0) it prints all stack frames |
技術的な詳細
戻り値: | 連想配列の配列 |
---|---|
PHPバージョン: | 4.3+ |
PHP変更ログ: | PHP 5.4:オプションのパラメーター制限が追加されました PHP 5.3.6:パラメーターprovide_objectがオプションに変更され、追加オプションDEBUG_BACKTRACE_IGNORE_ARGSが追加されました PHP 5.2.5:オプションのパラメーターprovide_objectが追加されまし たPHP 5.1.1:現在のオブジェクトが可能な限り追加されました戻り要素 |
PHPエラーリファレンス