PHP判断是否使用HTTPS
分类:PHP函数库
时间:2021-04-20
浏览:328
//判断是否HTTPS if (!function_exists('isHTTPS')) { function isHTTPS() { if (defined('HTTPS') && HTTPS) return true; if (!isset($_SERVER)) return FALSE; if (!isset($_SERVER['HTTPS'])) return FALSE; if ($_SERVER['HTTPS'] === 1) { //Apache return TRUE; } elseif ($_SERVER['HTTPS'] === 'on') { //IIS return TRUE; } elseif ($_SERVER['SERVER_PORT'] == 443) { //其他 return TRUE; } return FALSE; } }
本站文章如未注明出处则为原创,转载请注明出处,如有侵权请邮件联系站长