diff --git a/backend/getInfo.php b/backend/getInfo.php index a934c1f..6f107a7 100644 --- a/backend/getInfo.php +++ b/backend/getInfo.php @@ -128,4 +128,4 @@ function getVersion() { // 获取自身及数据库版本号 return $version; } -?> \ No newline at end of file +?> diff --git a/backend/ipip.php b/backend/ipip.php index 0de3bfd..e185e54 100644 --- a/backend/ipip.php +++ b/backend/ipip.php @@ -43,7 +43,14 @@ class IPDB { if ($node <= 0) { return NULL; } - return explode("\t", $this->getData($node)); + $data = explode("\t", $this->getData($node)); + foreach ($data as &$field) { + $field = trim($field); + } + if ($data[1] === '中国' && $data[2] === '中国') { + $data[1] = $data[2] = ''; + } + return $data; } private function getNode($ip) { // 获取节点编号 @@ -93,4 +100,4 @@ class IPDB { } } -?> \ No newline at end of file +?>