php截取省和市之前字符串
2019-06-01 本文已影响0人
geeooooz
$str="河北省乌鲁木齐市新华区";
$t1 = mb_strpos($str,'省');
$t2 = mb_strpos($str,'市');
echo $s = mb_substr($str,$t1+3,($t2)-$t1);
$str="河北省乌鲁木齐市新华区";
$t1 = mb_strpos($str,'省');
$t2 = mb_strpos($str,'市');
echo $s = mb_substr($str,$t1+3,($t2)-$t1);