$str = "http://wenwen.soso.com/z/ShowTagHighOffer.e?sp=17368320&sp=技能&sp=技能";需要对,后面两个 “&sp=技能&sp=技能” sp 的值进行urlencode编码,如何写?
$str = "http://wenwen.soso.com/z/ShowTagHighOffer.e?sp=17368320&sp=技能&sp=技能";需要对,后面两个 “&sp=技能&sp=技能” sp 的值进行urlencode编码,如何写?
调试欢乐多
$string='http://wenwen.soso.com/z/ShowTagHighOffer.e?sp=17368320&sp=技能&sp=技能';
$pattern = '/&sp=([^&]*)/';
preg_match_all($pattern, $string, $match); print_r($match[1]); foreach($match[1] as $v){
echo urlencode($v);
echo '<br>';
}
<?php$str = "http://wenwen.soso.com/z/ShowTagHighOffer.e?sp=17368320&sp=技能&sp=技能";$arr=preg_split("/&sp=/",$str);
echo $arr[1];
echo $arr[2];?>
你看这样对不对?