php判断是否SSL协议

作者:stoat 发布时间:2018-06-14 分类:闲扯

/**
 * 判断是否SSL协议
 * @return boolean
 */
function is_ssl() {
    if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')){
        return true;
    }elseif(isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'] )) {
        return true;
    }
    return false;
}

原文地址:php判断是否SSL协议 by 雪鼬博客

标签:none

评论已关闭