MR.ASONG

PHP判断是否为SSL链接(https)

2016/12/23 691 1
function is_ssl(){
    return isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 1 || strtolower($_SERVER['HTTPS'])=='on') 
        || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']==443
        || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
}

添加新评论