當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。