当前位置: 首页>>代码示例>>PHP>>正文


PHP HttpException::getHeaders方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpKernel\Exception\HttpException::getHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpException::getHeaders方法的具体用法?PHP HttpException::getHeaders怎么用?PHP HttpException::getHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpKernel\Exception\HttpException的用法示例。


在下文中一共展示了HttpException::getHeaders方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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("soda-example::errors.{$status}")) {
         return response()->view("soda-example::errors.{$status}", ['exception' => $e], $status, $e->getHeaders());
     } else {
         return response()->view("soda-example::errors.other", ['exception' => $e], $status, $e->getHeaders());
     }
 }
开发者ID:sodacms,项目名称:sodacms,代码行数:16,代码来源:ExceptionHandler.php

示例2:

 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

示例3: 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

示例4: 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

示例5: 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}", ['exception' => $e], $status, $e->getHeaders());
     } else {
         return $this->convertExceptionToResponse($e);
     }
 }
开发者ID:ziracmo,项目名称:Projet-transversal-2,代码行数:15,代码来源:Handler.php

示例6: renderHttpException

 /**
  * @param \Symfony\Component\HttpKernel\Exception\HttpException $exception
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function renderHttpException(HttpException $exception)
 {
     $status = $exception->getStatusCode();
     if ($this->view->exists("error::{$status}") && !$this->configuration->get('app.debug')) {
         return $this->response->view("error::{$status}", ['exception' => $exception], $status, $exception->getHeaders());
     } else {
         return $this->convertExceptionToResponse($exception);
     }
 }
开发者ID:notadd,项目名称:framework,代码行数:14,代码来源:Handler.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();
     $hoje = getdate();
     $hoje2 = $hoje['year'] . '-' . $hoje['mon'] . '-' . $hoje['mday'];
     $mensagem = MensagemAdm::all()->last();
     $acaos = DB::table('acaos')->select('*')->where('data_sorteio', '>=', $hoje2)->where('deleted_at', null)->where('winner_id', null)->get();
     $criador = DB::table('users')->select('*')->join('acaos', 'users.id', '=', 'acaos.user_id')->get();
     $rifas = DB::table('rifas')->select('*')->join('users', 'rifas.user_id', '=', 'users.id')->whereNotNull('user_id')->groupby('name', 'acao_id')->get();
     if (view()->exists("errors.{$status}")) {
         return response()->view("errors.{$status}", ['exception' => $e, 'mensagem' => $mensagem, 'acaos' => $acaos, 'criador' => $criador, 'rifas' => $rifas], $status, $e->getHeaders());
     } else {
         return $this->convertExceptionToResponse($e);
     }
 }
开发者ID:pedrohbraz,项目名称:rifasPando,代码行数:21,代码来源:ManutencaoHandler.php

示例8: handleHttpException

 private function handleHttpException(HttpException $e, $code)
 {
     $message = array('status' => $e->getStatusCode(), 'code' => $code, 'message' => $e->getMessage());
     return $this->app->json($message, $e->getStatusCode(), $e->getHeaders());
 }
开发者ID:aptoma,项目名称:silex-extras,代码行数:5,代码来源:JsonErrorHandler.php

示例9:

 function it_uses_the_headers_from_an_HttpExceptionInterface(HttpException $exception)
 {
     $exception->getStatusCode()->willReturn(401);
     $exception->getHeaders()->willReturn(array('Foo' => 'Bar'));
     $this->display($exception)->headers->get('Foo')->shouldBe('Bar');
 }
开发者ID:radweb,项目名称:json-exception-formatter,代码行数:6,代码来源:DisplayerSpec.php

示例10: createHttpExceptionResponse

 /**
  * Create a http response.
  *
  * @param HttpException $exception The exception to create a response for.
  *
  * @return JsonResponse
  */
 private function createHttpExceptionResponse(HttpException $exception)
 {
     return new JsonResponse(['status' => 'ERROR', 'message' => $exception->getMessage()], $exception->getStatusCode(), $exception->getHeaders());
 }
开发者ID:tenside,项目名称:core-bundle,代码行数:11,代码来源:ExceptionListener.php

示例11: testHeadersConstructor

 /**
  * @dataProvider headerDataProvider
  */
 public function testHeadersConstructor($headers)
 {
     $exception = new HttpException(200, null, null, $headers);
     $this->assertSame($headers, $exception->getHeaders());
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:8,代码来源:HttpExceptionTest.php


注:本文中的Symfony\Component\HttpKernel\Exception\HttpException::getHeaders方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。