バックトレースで各スタックフレームに設定された変数を表示する方法はありますか?debug_backtrace(true)
オブジェクトを取得する、get_object_vars
各オブジェクトで$ this vars、args
各バックトレースフレームのキーを取得する、およびget_defined_vars
グローバルを取得するという組み合わせでかなり近づくことができますが、関数内に設定された一時変数は方法を見つけることができません取得します。
状況の例を次に示します。
function method1($foo) {
$temp = method2($foo + 1);
foreach ($temp as $t) {
method2($t);
}
}
function method2($bar) {
$temp2 = $bar->value + $_GET['val'];
debug();
}
function debug() {
// to be created
$global_scope = get_defined_vars();
$bt = debug_backtrace(true);
}
バックトレースのキー、からのオブジェクト変数、およびからのグローバルを取得できます。との価値も知りたいです。$foo
$bar
args
$bar
get_object_vars
get_defined_vars
$temp2
$temp