可以使用正则表达式获取,例子代码:
$str=<<
运行结果:
Array
(
[0] => http://localhost/shopnc/data/upload/shop/editor/web-101-101-1.jpg
[1] => http://localhost/shopnc/data/upload/shop/editor/web-101-101-2.jpg
[2] => http://localhost/shopnc/data/upload/shop/editor/web-101-101-3.jpg
[3] => http://localhost/shopnc/data/upload/shop/editor/web-101-101-4.jpg
)
满足你的要求了吧?
用Javascript吧 php不太适合做这样的事情
function unescape($str) {
$str = rawurldecode($str);
preg_match_all("/%u.{4}|.{4};|d+;|.+/U",$str,$r);
$ar = $r[0];
foreach($ar as $k=>$v) {
if(substr($v,0,2) == "%u"){
$ar[$k] = mb_convert_encoding(pack("H4",substr($v,-4)),"gb2312","UCS-2");
}elseif(substr($v,0,3) == ""){
$ar[$k] = mb_convert_encoding(pack("H4",substr($v,3,-1)),"gb2312","UCS-2");
}elseif(substr($v,0,2) == "") {
$ar[$k] = mb_convert_encoding(pack("H4",substr($v,2,-1)),"gb2312","UCS-2");
}
}
return join("",$ar);
}
$str = '/?y=%u597D&m=%u554A&h=%20';
$query = parse_url($str,PHP_URL_QUERY);
parse_str($query);
echo unescape($y);
?>
求采纳为满意回答。