Skip to content

Commit

Permalink
ltrim 不支持中文,改为 mb_ 系列函数
Browse files Browse the repository at this point in the history
  • Loading branch information
itbdw committed Mar 25, 2018
1 parent 1941bfe commit c559ae1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/IpLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,12 @@ private function getAddr($ip)

//没有省份标志 只能替换
$_tmp_city = str_replace($location['province'], '', $location['country']);
$_tmp_city = ltrim($_tmp_city, $seperator_shi); //防止直辖市捣乱 上海市xxx区 =》 市xx区

//防止直辖市捣乱 上海市xxx区 =》 市xx区
$_tmp_shi_pos = mb_stripos($_tmp_city, $seperator_shi);
if ($_tmp_shi_pos === 0) {
$_tmp_city = mb_substr($_tmp_city, 1);
}

//内蒙古 类型的 获取市县信息
if (strpos($_tmp_city, $seperator_shi) !== false) {
Expand Down

1 comment on commit c559ae1

@itbdw
Copy link
Owner Author

@itbdw itbdw commented on c559ae1 Mar 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8 fixed

Please sign in to comment.