jerry 1 年之前
父節點
當前提交
fd172f2243
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      common/libs/IpFilter.php

+ 1 - 3
common/libs/IpFilter.php

@@ -22,9 +22,7 @@ class IpFilter extends Component
      */
      */
     public function checkIp()
     public function checkIp()
     {
     {
-        $request = Yii::$app->getRequest();
-        $remoteAddr = $request->getUserIP(); // 获取用户 IP 地址
-
+        $remoteAddr = $_SERVER['REMOTE_ADDR']; // 获取用户 IP 地址
         if (!self::remoteAddrCall($remoteAddr)) {
         if (!self::remoteAddrCall($remoteAddr)) {
             throw new BadRequestHttpException('非法 IP 地址');
             throw new BadRequestHttpException('非法 IP 地址');
         }
         }