当前位置: 首页>>代码示例>>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;未经允许,请勿转载。