1.配置未找到404错误
App\Exceptions\Handler render 方法里加入
if (!($exception instanceof AuthenticationException)) {
return response()->json([
'errorinfo' => ['c_err'=>'Resource not found.','err_data'=>123,'err_code' => 404]
],404);
}
本文介绍了一种在PHP应用程序中处理404错误的方法。通过修改AppExceptionsHandler类的render方法,当出现未认证的404错误时,返回JSON格式的错误信息,包括错误代码404及详细的错误描述。
578

被折叠的 条评论
为什么被折叠?



