在PHP中,urldecode() 函数用于对 URL 编码后的字符串进行解码。以下是urldecode() 函数的使用方法:
$url = "https%3A%2F%2Fwww.example.com%2Fpage%3Fid%3D123";
$decoded_url = urldecode($url);
echo $decoded_url;
$url = "https%3A%2F%2Fwww.example.com%2Fpage%3Fid%3D123";
$decoded_url = urldecode($url);
echo $decoded_url;
$str = "Hello%20World%21";
$decoded_str = urldecode($str);
echo $decoded_str;
$str = "%E4%BD%A0%E5%A5%BD";
$decoded_str = urldecode($str);
echo $decoded_str;
注意:在解码时,需要确保字符串是经过urlencode()函数编码的,否则可能会出现解码错误。