Exception::getTrace

(PHP 5, PHP 7, PHP 8)

Exception::getTrace — 스택 추적을 가져옵니다.


설명

final public Exception::getTrace(): array

예외 스택 추적을 반환합니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

예외 스택 추적을 배열로 반환합니다.


Examples

예제 #1 Exception::getTrace() 예제

                  
<?php
function test() {
 throw new Exception;
}

try {
 test();
} catch(Exception $e) {
 var_dump($e->getTrace());
}
?>
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

array(1) {
  [0]=>
  array(4) {
    ["file"]=>
    string(22) "/home/bjori/tmp/ex.php"
    ["line"]=>
    int(7)
    ["function"]=>
    string(4) "test"
    ["args"]=>
    array(0) {
    }
  }
}
                

기타