laravel 浏览器谷歌network返回报错html

laravel 在谷歌报错的时候会返回html,对于调试来说很不方便。
原因是在于:

 

这里返回的格式是json,但是报错时候返回的是整个html
所以

 

相对路径: appExceptionsHandler.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里面的这个方法改一下就可以了

原文地址:https://www.cnblogs.com/chenrunxuan/p/12826301.html