打你一下

php判读是请求是http还是https

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://";
}

posted on 2020-06-27 16:11  打你一下  阅读(925)  评论(0编辑  收藏  举报

导航