PHP的parse_url函數(shù)不會(huì)自動(dòng)解碼URL編碼。如果URL中包含編碼字符,parse_url函數(shù)會(huì)將其當(dāng)作普通字符對(duì)待并返回。如果需要解碼URL編碼的部分,可以使用urldecode函數(shù)對(duì)URL進(jìn)行解碼。例如:
$url = 'https://www.example.com/path/to/page?query=%26%3D%3F';
$parsed_url = parse_url($url);
$query = $parsed_url['query'];
$decoded_query = urldecode($query);
echo $decoded_query; // 輸出:&=?