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


PHP ExceptionHandler::getHtml方法代碼示例

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


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

示例1: handleWithSymfony

 protected function handleWithSymfony(Exception $exception)
 {
     if (!$exception instanceof FlattenException) {
         $exception = FlattenException::create($exception);
     }
     $handler = new ExceptionHandler($this->debug);
     return Response::create($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders());
 }
開發者ID:autarky,項目名稱:framework,代碼行數:8,代碼來源:DefaultErrorHandler.php

示例2: onSilexError

 public function onSilexError(GetResponseForExceptionEvent $event)
 {
     $handler = new DebugExceptionHandler($this->debug);
     $exception = $event->getException();
     if (!$exception instanceof FlattenException) {
         $exception = FlattenException::create($exception);
     }
     $response = Response::create($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset(ini_get('default_charset'));
     $event->setResponse($response);
 }
開發者ID:abdonor,項目名稱:silex_simple_api,代碼行數:10,代碼來源:ExceptionHandler.php

示例3: __toString

 public function __toString()
 {
     try {
         return parent::__toString();
         // TODO: Change the autogenerated stub
     } catch (\Exception $exc) {
         ExceptionHelper::logException($exc);
         $eh = new ExceptionHandler(env('APP_DEBUG'));
         die($eh->getHtml($exc));
     }
 }
開發者ID:despark,項目名稱:ignicms,代碼行數:11,代碼來源:View.php

示例4: minionError

    /**
     * @internal
     *
     * Handle errors and exceptions thrown by entire application.
     *
     * @param \Exception $ex   Any exception
     * @param integer    $code HTTP status code
     *
     * @return Response Response to the client with nice error page
     */
    public function minionError(\Exception $ex, $code)
    {
        $handler = new ExceptionHandler($this['debug']);
        $exception = FlattenException::create($ex);
        $response = Response::create($handler->getHtml($exception), $code, $exception->getHeaders())->setCharset(\ini_get('default_charset'));
        if ($this['debug']) {
            return $response;
        } else {
            $content = <<<'HTML'
<!DOCTYPE html>
<html>
    <head><title>Error %d</title></head>
    <body><h1>Error %d occured</h1></body>
</html>
HTML;
            if ($this['minion.useTwig']) {
                $twig = $this['twig'];
                $tpl = "Static/{$code}.html.twig";
                if (!Utils::templateExists($twig, $tpl)) {
                    $content = \str_replace('%d', $code, $content);
                } else {
                    $content = $twig->render($tpl, ['exception' => $ex]);
                }
            } elseif (\file_exists($tpl = Utils::fixPath($this->getRootDir() . "/Static/{$code}.html.php"))) {
                $content = Utils::renderPhpTemplate($tpl, ['exception' => $ex]);
            }
            $response->setStatusCode($code);
            $response->setContent($content);
            return $response;
        }
    }
開發者ID:dszczer,項目名稱:Minion,代碼行數:41,代碼來源:Application.php

示例5: convertExceptionToResponse

 /**
  * @param \Exception $exception
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function convertExceptionToResponse(Exception $exception)
 {
     $exception = FlattenException::create($exception);
     $handler = new SymfonyExceptionHandler($this->configuration->get('app.debug'));
     return SymfonyResponse::create($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders());
 }
開發者ID:notadd,項目名稱:framework,代碼行數:11,代碼來源:Handler.php

示例6: __toString

 /**
  * @return string
  */
 public function __toString()
 {
     try {
         $this->beforeToHtml();
         $html = $this->toHtml();
         $html = $this->afterToHtml($html);
     } catch (\Exception $exc) {
         $eh = new ExceptionHandler(env('APP_DEBUG'));
         die($eh->getHtml($exc));
     }
     return $html;
 }
開發者ID:despark,項目名稱:ignicms,代碼行數:15,代碼來源:Field.php


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