1, 'message' => '', 'data' => [] ]; // 参数验证错误 if ($e instanceof ValidateException) { $json['message'] = $e->getError(); return json($json); } // 请求异常 if ($e instanceof HttpException && request()->isAjax()) { $json['message'] = $e->getMessage(); return json($json,$e->getStatusCode()); } $json['message'] = $e->getMessage(); return json($json); } }