18
如何解码在url url使用encodeURIComponent()编码的url?如何解码在URL url使用encodeURIComponent()
我曾尝试urldecode(),但随后also..i不,我有编码的网址...
我必须这样做在PHP ..
如何解码在url url使用encodeURIComponent()编码的url?如何解码在URL url使用encodeURIComponent()
我曾尝试urldecode(),但随后also..i不,我有编码的网址...
我必须这样做在PHP ..
您应该使用rawurldecode()
。
见Manual
您可以使用此功能:
<?php
$smth = 'http%3A%2F%2Fexample.com';
$smth = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($smth));
$smth = html_entity_decode($smth,null,'UTF-8');
echo $smth ;
?>
输出将是:http://example.com
这解决了我的问题,谢谢! – Rako 2013-06-07 12:10:16