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