Jump to content
新域网络技术论坛

获得当前完整链接(不含参数)


Jamers
 Share

Recommended Posts

包括协议,端口以及路径。

function getcururl() {
    $http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
     && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://'; 
    $self = $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
    return $http_type.$self;
}
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...