Skip to content

Commit

Permalink
修复ipv6 识别市区包含中国的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
itbdw committed May 26, 2022
1 parent 42a532f commit 415df94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/StringParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ public static function parse($location, $withOriginal = false)
return $result;
}

//ipv6 会包含中国 故意去掉

if (strpos($location['country'], "中国") === 0) {
$location['country'] = str_replace("中国", "", $location['country']);
}

$location['org_country'] = $location['country']; //北京市朝阳区

$location['org_area'] = $location['area']; // 金桥国际小区
Expand Down
4 changes: 3 additions & 1 deletion tests/ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"162.105.217.0", //,"province":"北京大学万柳学区","ci

"fe80:0000:0001:0000:0440:44ff:1233:5678",
"2409:8900:103f:14f:d7e:cd36:11af:be83"
"2409:8900:103f:14f:d7e:cd36:11af:be83",
"2400:3200:baba::1",//阿里云



];
Expand Down

0 comments on commit 415df94

Please sign in to comment.