【发布时间】:2013-05-21 14:42:38
【问题描述】:
我想阅读一个网址。 www.domain.com?cookie=set&redirect=yes
现在我想使用$ _SERVER['REQUEST_URI'],但这不适用于strip_tags 和htmlspecialchars。
我读到的还有很多你应该注意 XSS。
有谁知道如何保存一个可以被 GET 使用的 URL?
$url = "http://'.$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI];
$url = strip_tags($url);//doesnt work
$url = htmlspecialchars($url);//doesnt work
谢谢!
编辑为(不起作用):
$url = "http://".$_SERVER[HTTP_HOST]."".$_SERVER[REQUEST_URI];
$url = strip_tags($url);
echo $url;
例如 www.domain.com?cookie=set&reddirect=yes
输出 => index.php?cookie=se%3Cscript%3Et&re%3Cb%3Ed%3C/b%3Eirect=yes
【问题讨论】: