2017-11-30 1 views
0

Laravel 4.2를 Laravel 5.0으로 업그레이드 중입니다.Laravel 5의 HTTP 오류 상태를 확인하는 방법

/** 
* Report or log an exception. 
* 
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. 
* 
* @param \Exception $e 
* @return void 
*/ 
public function report(Exception $e) 
{ 
    ... 

    return parent::report($e); 
} 

내가 report 방법 응답의 오류 코드 (500,404, ...)를 얻는 방법을 알고 싶어요 : 내 앱/예외/Handler.php 파일에서 나는이 같은 코드가 있습니다.

감사합니다. 모두들 !!

답변

0

이 작업을 시도 할 수 있습니다 :

// If this exception is an instance of HttpException 
    if ($this->isHttpException($e)) { 
     // Grab the HTTP status code from the Exception 
     $status = $e->getStatusCode(); 
    } 
0
if ($e instanceof \Symfony\Component\HttpKernel\Exception\HttpException) 
{ 
    $e->getStatusCode(); 
} 
관련 문제