路径:项目/app/Exceptions/Handler.php
public function render($request, Exception $exception) { if(!empty($exception)){ $url = URL::current(); $urlData = parse_url($url); $midware = substr($urlData['path'],0,6); if($midware != '/admin'){ echo '参数缺失,系统错误!';exit; } return response()->json(['message'=>'参数缺失,系统异常!', 'code'=>99999]); } return parent::render($request, $exception); }