开发者

how do you copy a url into variable

I'm trying to copy a url that looks like this: http://domain.com/myfile.php?test-main

开发者_开发知识库

So I'm trying to get the url so I can add variable r to the end like so: http://domain.com/myfile.php?test-main?r=stuff

When I use $_SERVER['REQUEST_URI'] it just copies the file name myfile.php and not the other variables. Any one how I can copy the entire url?


$addr = "http://".$_SERVER['SERVER_NAME']."/".$_SERVER['REQUEST_URI']."?".$_SERVER['QUERY_STRING']."&r=stuff";

And you might want to filter variables for a possible XSS attack


Build it yourself out of the provided parts.

Do a print_r($_SERVER); to see all available

The main one you want to add is HTTP_HOST

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜