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: 매개변수 provider_object가 options 로 변경 되고 추가 옵션 DEBUG_BACKTRACE_IGNORE_ARGS가 추가되었습니다 . PHP 5.2.5: 선택적 매개변수 provider_object 가 추가되었습니다 . PHP 5.1.1: 현재 객체를 가능한 한 추가했습니다. 반환 요소 |
PHP 오류 참조