如何在 php 中解码使用 encodeURIComponent() 编码的 url?
我已经尝试了 urldecode() 但也..我没有我编码的 url ......
我必须在 php..
如何在 php 中解码使用 encodeURIComponent() 编码的 url?
我已经尝试了 urldecode() 但也..我没有我编码的 url ......
我必须在 php..
你应该使用rawurldecode()
.
见手册
你可以使用这个功能:
<?php
$string = 'http%3A%2F%2Fexample.com';
$output = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($string));
echo html_entity_decode($output,null,'UTF-8');
?>
输出将是:http://example.com