您可以通过提交执行搜索:
input: Lösung? Tösung& -> url: http://127.0.0.1/?search=Lösung%3F+Tösung%26如果您尚未登录,则我将使用url_encode重定向(location header)搜索以登录:
...login/return_url=http%3A%2F%2F127.0.0.1%2F%3Fsearch%3DLösung%3F+Tösung%26amp%3B我得到$_ get“‘return_url”的“错误”结果
http://127.0.0.1/?search=Lösung? Tösung&当登录并在重定向(不再编码url )之后,我得到:
url: http://127.0.0.1/?search=Lösung? Tösung& -> input: Lösung? Tösung也许我应该重定向到之前编码的url?但是我得到一个错误(url不可读?)
header("Location: ".urlencode(url)."");我如何才能在重定向后仍然得到像第一个url一样的结果,并且不会像在示例中那样丢失特殊字符?
发布于 2013-05-16 22:41:47
我看到的第一件事是给出了错误的url。URL中$_GET[]的格式应为
http:// domain.com/index.php?myvar=var&myfoo=foo对于页面后的第一个变量,使用'?',之后的每个变量都与'&'耦合
urlencode和urldecode修复了字符的问题。
$url= "http://www.mysite.com/index.php?search=location&option=europe";
$encoded = urlencode($url);
// result: http%3A%2F%2Fwww.mysite.com%2Findex.php%3Fsearch%3Dlocation%26option%3Deurope
$decoded = urldecode($encoded);
// result: http://www.mysite.com/index.php?search=location&option=europe使用您的url:
$url= "http://127.0.0.1/?search=Lösung%3F+Tösung%26";编码:
http%3A%2F%2F127.0.0.1%2F%3Fsearch%3DL%C3%B6sung%253F%2BT%C3%B6sung%2526http://127.0.0.1/?search=Lösung%3F+Tösung%26 发布于 2013-05-16 22:31:58
我觉得你需要rawurlencode()
https://stackoverflow.com/questions/16590177
复制相似问题