注意變數的生命週期
###############################################################################
# 取得目前網址
###############################################################################
if(!function_exists("getCurrentUrl")){
function getCurrentUrl(){
global $_SERVER;
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https')=== FALSE ? 'http' : 'https';
$host = $_SERVER['HTTP_HOST'];
$script = $_SERVER['SCRIPT_NAME'];
$params = $_SERVER['QUERY_STRING']?'?' . $_SERVER['QUERY_STRING']:"";
$currentUrl = $protocol . '://' . $host . $script . $params;
//die( $currentUrl);
return $currentUrl;;
}
}