當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HttpException::getStatusCode方法代碼示例

本文整理匯總了PHP中Symfony\Component\HttpKernel\Exception\HttpException::getStatusCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP HttpException::getStatusCode方法的具體用法?PHP HttpException::getStatusCode怎麽用?PHP HttpException::getStatusCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\HttpKernel\Exception\HttpException的用法示例。


在下文中一共展示了HttpException::getStatusCode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param  \Symfony\Component\HttpKernel\Exception\HttpException  $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     if (view()->exists('errors.' . $e->getStatusCode())) {
         return response()->view('errors.' . $e->getStatusCode(), [], $e->getStatusCode());
     } else {
         return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
     }
 }
開發者ID:avil13,項目名稱:cross-fit.loc,代碼行數:14,代碼來源:Handler.php

示例2: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param  \Symfony\Component\HttpKernel\Exception\HttpException $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     // load base JS
     JavaScript::put(['base_url' => url('/'), 'site_name' => config('settings.app_name_' . config('app.locale'))]);
     $seo_meta = ['page_title' => 'Erreur ' . $e->getStatusCode(), 'meta_desc' => $e->getMessage(), 'meta_keywords' => ''];
     $data = ['code' => $e->getStatusCode(), 'seo_meta' => $seo_meta, 'css' => elixir('css/app.error.css')];
     return response()->view('templates.common.errors.errors', $data);
 }
開發者ID:Okipa,項目名稱:una.app,代碼行數:14,代碼來源:Handler.php

示例3: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param  \Symfony\Component\HttpKernel\Exception\HttpException  $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     if (view()->exists('errors.' . $e->getStatusCode())) {
         return response()->view('errors.' . $e->getStatusCode(), ['message' => $e->getMessage(), 'trace' => $e->getTraceAsString(), 'debug' => config('app.debug')], $e->getStatusCode());
     } else {
         return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
     }
 }
開發者ID:BryceHappy,項目名稱:lavender,代碼行數:14,代碼來源:Handler.php

示例4: renderHttpException

 /**
  * 自定義錯誤頁
  */
 protected function renderHttpException(HttpException $e)
 {
     if (Request::ajax() and !config('app.debug')) {
         return responseJson($e->getStatusCode(), false);
     } elseif (view()->exists('error.common') and !config('app.debug')) {
         return response()->view('error.common', ['errorCode' => $e->getStatusCode()], $e->getStatusCode());
     } else {
         return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
     }
 }
開發者ID:pfdtk,項目名稱:bmsys,代碼行數:13,代碼來源:Handler.php

示例5: handle

 /**
  * Handle not found exception.
  *
  * @param  \Symfony\Component\HttpKernel\Exception\HttpException $e
  *
  * @return mixed
  */
 public function handle(HttpException $e)
 {
     $errorViewName = 'errors.' . $e->getStatusCode();
     // Here we check whether view is exist. For example if you got 404 status,
     // then we need a `errors.404` view file. If it exists, we render that view,
     // otherwise, we just throw back the exception, leaving it uncaught.
     if (View::exists($errorViewName)) {
         return Response::make(View::make($errorViewName, ['error' => $e]), $e->getStatusCode())->send();
     }
     throw $e;
 }
開發者ID:krisanalfa,項目名稱:hero,代碼行數:18,代碼來源:BaseHttpExceptionHandler.php

示例6:

 function it_prepares_http_exceptions(HttpException $httpException)
 {
     $httpException->getStatusCode()->willReturn(404);
     $httpException->getHeaders()->willReturn(['Header:test']);
     $this->handleException($httpException);
     $this->sendHttpCode()->shouldReturn(404);
     $this->headers()->shouldReturn(['Header:test']);
 }
開發者ID:kenarkose,項目名稱:meltdown,代碼行數:8,代碼來源:LaravelAccidentSpec.php

示例7: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param  \Symfony\Component\HttpKernel\Exception\HttpException  $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     $status = $e->getStatusCode();
     if (view()->exists(config('smile.theme') . '::' . "errors.{$status}")) {
         return response()->view(config('smile.theme') . '::' . "errors.{$status}", [], $status);
     }
     return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
 }
開發者ID:vjaykoogu,項目名稱:smile-media-laravel,代碼行數:14,代碼來源:Handler.php

示例8: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param  \Symfony\Component\HttpKernel\Exception\HttpException  $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     $status = $e->getStatusCode();
     if (view()->exists("errors.{$status}")) {
         return response()->view("errors.{$status}", ['message' => $e->getMessage()], $status);
     }
     return parent::renderHttpException($e);
 }
開發者ID:uicestone,項目名稱:SmartBuild,代碼行數:14,代碼來源:Handler.php

示例9: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param HttpException $e
  *
  * @return \Illuminate\Http\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     $code = $e->getStatusCode();
     $default_config = ['title' => 'エラーが発生しました。', 'msg' => 'エラーが発生しました。'];
     $error_set = config("errors.{$code}", $default_config);
     $data = array_merge($error_set, ['exception' => $e]);
     return response()->view('errors.all', $data, $code);
 }
開發者ID:Hiroto-K,項目名稱:HkApps,代碼行數:15,代碼來源:Handler.php

示例10: convertHttpExceptionToJsonResponse

 protected function convertHttpExceptionToJsonResponse(HttpException $exc)
 {
     $data = json_decode($exc->getMessage(), true);
     if (!is_array($data)) {
         $data = ['_message' => $exc->getMessage()];
     }
     return new JsonResponse($data, $exc->getStatusCode());
 }
開發者ID:swayok,項目名稱:laravel-extended-errors,代碼行數:8,代碼來源:ExceptionHandler.php

示例11: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param  \Symfony\Component\HttpKernel\Exception\HttpException  $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     $status = $e->getStatusCode();
     if (view()->exists("csm::errors.{$status}")) {
         return response()->view("errors.{$status}", ['message' => $e->getMessage(), 'line' => $e->getLine(), 'file' => $e->getFile(), 'code' => $status, 'bodyId' => 'error.' . $status], $status);
     } else {
         return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
     }
 }
開發者ID:BlueCatTAT,項目名稱:kodicms-laravel,代碼行數:15,代碼來源:Handler.php

示例12: renderHttpException

 protected function renderHttpException(HttpException $e)
 {
     $status = $e->getStatusCode();
     if (view()->exists($this->pathErrors . $status)) {
         return response()->view($this->pathErrors . $status, ['exception' => $e], $status, $e->getHeaders());
     } else {
         return parent::renderHttpException($e);
     }
 }
開發者ID:neomusic,項目名稱:laravel-section-error-views,代碼行數:9,代碼來源:SectionHandler.php

示例13: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param  HttpException $e
  * @return Response
  */
 protected function renderHttpException(HttpException $e)
 {
     $status = $e->getStatusCode();
     if (view()->exists("errors.{$status}")) {
         return response(view("errors.{$status}"), $status);
     } else {
         return (new SymfonyExceptionHandler(env('APP_DEBUG')))->createResponse($e);
     }
 }
開發者ID:andrelotto,項目名稱:ApiCidadeEstadosIbge,代碼行數:15,代碼來源:Handler.php

示例14: renderHttpException

 /**
  * Функция для отображения сообщений на страницах ошибок (404, 500 etc.)
  * @param HttpException $e
  * @return \Illuminate\Http\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     $status = $e->getStatusCode();
     if (view()->exists("errors.{$status}")) {
         return response()->view("errors.{$status}", ['message' => $e->getMessage(), 'status' => $status, 'headers' => $e->getHeaders()], $status);
     } else {
         return $status;
     }
 }
開發者ID:valik619,項目名稱:find-out.dev,代碼行數:14,代碼來源:Handler.php

示例15: renderHttpException

 /**
  * Render the given HttpException.
  *
  * @param  \Symfony\Component\HttpKernel\Exception\HttpException  $e
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $e)
 {
     $status = $e->getStatusCode();
     if (view()->exists("jplatformui::errors.{$status}")) {
         return response()->view("jplatformui::errors.{$status}", ['exception' => $e], $status);
     } else {
         return $this->convertExceptionToResponse($e);
     }
 }
開發者ID:hechoenlaravel,項目名稱:jarvis-platform,代碼行數:15,代碼來源:Handler.php


注:本文中的Symfony\Component\HttpKernel\Exception\HttpException::getStatusCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。