Skip to content

Commit 415df94

Browse files
committed
修复ipv6 识别市区包含中国的问题
1 parent 42a532f commit 415df94

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/StringParser.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ public static function parse($location, $withOriginal = false)
104104
return $result;
105105
}
106106

107+
//ipv6 会包含中国 故意去掉
108+
109+
if (strpos($location['country'], "中国") === 0) {
110+
$location['country'] = str_replace("中国", "", $location['country']);
111+
}
112+
107113
$location['org_country'] = $location['country']; //北京市朝阳区
108114

109115
$location['org_area'] = $location['area']; // 金桥国际小区

tests/ip.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
"162.105.217.0", //,"province":"北京大学万柳学区","ci
3333

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

3739

3840
];

0 commit comments

Comments
 (0)