We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1941bfe commit c559ae1Copy full SHA for c559ae1
1 file changed
src/IpLocation.php
@@ -267,7 +267,12 @@ private function getAddr($ip)
267
268
//没有省份标志 只能替换
269
$_tmp_city = str_replace($location['province'], '', $location['country']);
270
- $_tmp_city = ltrim($_tmp_city, $seperator_shi); //防止直辖市捣乱 上海市xxx区 =》 市xx区
+
271
+ //防止直辖市捣乱 上海市xxx区 =》 市xx区
272
+ $_tmp_shi_pos = mb_stripos($_tmp_city, $seperator_shi);
273
+ if ($_tmp_shi_pos === 0) {
274
+ $_tmp_city = mb_substr($_tmp_city, 1);
275
+ }
276
277
//内蒙古 类型的 获取市县信息
278
if (strpos($_tmp_city, $seperator_shi) !== false) {
0 commit comments