如何解码数组中的url数据和访问,并解码url中的%value


How do I decode url data and access in array and decode % value from urls

我正在尝试使用此代码从json和数组中获取信息,但我无法解码数据中的%值,也无法访问数组。有人能帮我吗?

$url = 'http://www.example.com/video?&video_id=MvK7ibgRREw&asv=3&el=detailpage&hl=en_US';
$data = file_get_contents($url);
header('Content-Type: application/json');
echo $data;

这应该有效。。。

$url = 'http://www.youtube.com/get_video_info?&video_id=MvK7ibgRREw&asv=3&el=detailpage&hl=en_US';
$data = file_get_contents($url);
$array = explode('&', $data);
for ($i=0; $i<count($array); $i++){
    $array[$i] = urldecode($array[$i]);
}
$json = json_encode($array);
echo $json;