is_ssl()
最后更新于:2021-11-27 11:15:28
is_ssl()Determines if SSL is used.
响应
(bool) True if SSL, otherwise false.
源文件
文件: gc-includes/load.php
function is_ssl() {
if ( isset( $_SERVER['HTTPS'] ) ) {
if ( 'on' === strtolower( $_SERVER['HTTPS'] ) ) {
return true;
}
if ( '1' == $_SERVER['HTTPS'] ) {
return true;
}
} elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
return false;
}
function gcdocs_maybe_is_ssl() { // cloudflare if ( ! empty( $_SERVER['HTTP_CF_VISITOR'] ) ) { $cfo = json_decode( $_SERVER['HTTP_CF_VISITOR'] ); if ( isset( $cfo->scheme ) && 'https' === $cfo->scheme ) { return true; } } // other proxy if ( ! empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { return true; } return function_exists( 'is_ssl' ) ? is_ssl() : false; }