Skip to content

Commit

Permalink
Merge pull request #134 from wonder-game/develop
Browse files Browse the repository at this point in the history
fix: 修正分隔符
  • Loading branch information
linkunyuan authored Nov 27, 2024
2 parents 2692d7c + 23c4222 commit 1b151ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/function.php
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,8 @@ function geo($ip = '', $num = 'all')
$region = $dbSearcher->search($ip);
$dbSearcher->close();

// 注意分隔符一定要用–,最好是复制粘贴,以防写错!!!

// ip解析示例:
// ["美国–新泽西州–伯灵顿", "Comcast有线通信股份有限公司"]
// ["中国–广东–深圳", "电信"]
Expand All @@ -866,7 +868,7 @@ function geo($ip = '', $num = 'all')

$arr = explode("\t", $region);
// 业务需求,港澳台跟大陆一样保持在第一级
$str = str_replace(['中国–台湾', '中国–香港', '中国–澳门', '中国-'], ['中国台湾–台湾', '中国香港–香港', '中国澳门–澳门', '中国'.config('INLAND').'-'], $arr[0]);
$str = str_replace(['中国–台湾', '中国–香港', '中国–澳门', '中国'], ['中国台湾–台湾', '中国香港–香港', '中国澳门–澳门', '中国' . config('INLAND') . ''], $arr[0]);
$arr = explode('', $str);

return is_numeric($num) ? $arr[$num] : $arr;
Expand Down

0 comments on commit 1b151ba

Please sign in to comment.