image.png
laravel 在谷歌報(bào)錯(cuò)的時(shí)候會(huì)返回html,對于調(diào)試來說很不方便看幼。
原因是在于:
image.png
這里返回的格式是json席覆,但是報(bào)錯(cuò)時(shí)候返回的是整個(gè)html
所以
image.png
相對路徑: app\Exceptions\Handler.php
public function render($request, Exception $exception)
{
$response = parent::render($request, $exception);
$response->header('Content-Type','text/html;charset=utf-8');
return $response;
}
在handler.php里面的這個(gè)方法改一下就可以了
image.png