如何在laravel 5调试器中获取laravel 4调试器页面 页
这里
到
答案 0 :(得分:1)
安装whoops包:
composer require filp/whoops
然后通过编辑app/Exceptions/Handler.php
:
<?php namespace App\Exceptions;
use Exception;
use Whoops\Run as Whoops;
use Illuminate\Http\Response;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use PragmaRX\Sdk\Services\ExceptionHandler\Service\Facade as SdkExceptionHandler;
class Handler extends ExceptionHandler {
protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\HttpException'
];
public function report(Exception $e)
{
return parent::report($e);
}
public function render($request, Exception $e)
{
if ($this->isHttpException($e))
{
return $this->renderHttpException($e);
}
if (env('APP_DEBUG'))
{
return $this->whoops($e);
}
return parent::render($request, $e);
}
protected function whoops(Exception $e)
{
$handled = with(new Whoops)
->pushHandler(new \Whoops\Handler\PrettyPageHandler())
->handleException($e);
return new Response(
$handled,
$e->getStatusCode(),
$e->getHeaders()
);
}
}