PHP判断是否为Https协议

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


by 雪洁 2019-06-24 10:05:00 108 views
我来说几句

相关文章