php获取页面的url和query_string

获取主机地址 host

$_SERVER['HTTP_HOST']; #www.lren.org

获取path

$_SERVER['PHP_SELF'] #/html/index.jsp

获取参数

 $_SERVER["QUERY_STRING"];     #id=755&name=lren

获取代理

 $_SERVER['HTTP_REFERER']

获取完整的url

echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
//包含端口号的完整url
echo 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
#http://www.lren.org:80/html/index.jsp?id=755&name=lren