php:is_ssl

SSLであるかを調べる

Dokuwiki - init.php より

/**
 * Check if accessed via HTTPS
 *
 * Apache leaves ,$_SERVER['HTTPS'] empty when not available, IIS sets it to 'off'.
 * 'false' and 'disabled' are just guessing
 *
 * @returns bool true when SSL is active
 */
function is_ssl(){
    if (!isset($_SERVER['HTTPS']) ||
        preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){
        return false;
    }else{
        return true;
    }
}
  • php/is_ssl.txt
  • 最終更新: 2024/03/27 10:51
  • by ともやん