2010-05-03 150 views

回答

18

您应该使用rawurldecode()
Manual

6

您可以使用此功能:

<?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

+0

这解决了我的问题,谢谢! – Rako 2013-06-07 12:10:16