diff --git a/application/http/middleware/Initialize.php b/application/http/middleware/Initialize.php index 85c832fb..a3e89730 100644 --- a/application/http/middleware/Initialize.php +++ b/application/http/middleware/Initialize.php @@ -18,14 +18,14 @@ class Initialize if ($request->controller(true) !== 'install' || $request->action(true) !== 'index') { return redirect(url('install/index')); } - } - - // 检测封禁IP - $banIp = $this->getConfig('ban_ip'); - if ($banIp) { - $ips = explode(',', str_replace(',', ',', $banIp)); - if ($this->banIp($request->ip(), $ips)) { - throw new HttpResponseException(Response::code(403)); + } else { + // 检测封禁IP + $banIp = $this->getConfig('ban_ip'); + if ($banIp) { + $ips = explode(',', str_replace(',', ',', $banIp)); + if ($this->banIp($request->ip(), $ips)) { + throw new HttpResponseException(Response::code(403)); + } } }