<?php
/**
* 获取当前页面完整
url地址
* site http://www.jb200.com
*/
function selfURL(){
//$_SERVER["REQUEST_URI"] 只有
apache 才支持,
//因此需要下面的判断来解决通用问题
if (isset($_SERVER['REQUEST_URI']))
{
$serverrequri = $_SERVER['REQUEST_URI'];
}
else
{
if (isset($_SERVER['argv']))
{
$serverrequri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];
}
else if(isset($_SERVER['QUERY_STRING']))
{
$serverrequri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
}
}
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strstr(strtolower($_SERVER["SERVER_PROTOCOL"]), "/",true).$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$serverrequri;
}
?>