ip(); $forbiddenip = site_config('basic.forbiddenip'); if($forbiddenip){ $forbiddenipArr=array_filter(explode("\n", str_replace("\r\n", "\n", $forbiddenip)));; if (count($forbiddenipArr)>0 && \Symfony\Component\HttpFoundation\IpUtils::checkIp($ip, $forbiddenipArr)) { $response = Response::create('请求无权访问', 'html', 403); throw new HttpResponseException($response); } } return $next($request); } }