PHP获取当前页面完整url地址函数,包括参数windows与linux都可用
代码如何下:
function get_cur_url() {
if (! empty($_SERVER['REQUEST_URI'])) {
$scriptName = $_SERVER['REQUEST_URI'];
$nowurl = $scriptName;
} else {
$scriptName = $_SERVER['PHP_SELF'];
if (empty($_SERVER['QUERY_STRING'])) {
$nowurl = $scriptName;
} else {
$nowurl = $scriptName . '?' . $_SERVER['QUERY_STRING'];
}
}
return nowurl;
}