PHP判断当前是否https协议

/**
 * isHttps
 *
 * @return boolean
 */
public function isHttps()
{
    return (
        (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') or
        (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    );
}
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页