经测试代码如下:
/**
* 获取页面的完整地址
*
* @param
* @arrange (512.笔记) jb51.cc
**/
function full_url()
{
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = substr(strtolower($_SERVER["SERVER_PROTOCOL"]),strpos(strtolower($_SERVER["SERVER_PROTOCOL"]),"/")) . $s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
/*** 代码来自编程之家 jb51.cc(jb51.cc) ***/