function GetHttp() {
if (isset($_SERVER[‘HTTPS‘]) && (‘1‘ == $_SERVER[‘HTTPS‘] || ‘on‘ == strtolower($_SERVER[‘HTTPS‘]))) {
return "https://";
} elseif (isset($_SERVER[‘SERVER_PORT‘]) && (‘443‘ == $_SERVER[‘SERVER_PORT‘] )) {
return "https://";
}
return "http://";
}
原文:https://www.cnblogs.com/-lsf/p/13198657.html