首页 运维 脚本开发 查看内容

php判断请求是http还是https

2021-11-20 11:05 3654 0

摘要: function GetHttp() { if (isset($_SERVER) ('1' == $_SERVER || 'on' == strtolower($_SERVER))) { return "https://"; } elseif (isset($_SERVER) ('443' == $_SERVER )) { return "https://"; } return "http:/ ...
关键词: SERVER HTTPS return isset PORT strtolower function GetHttp elseif http

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.toutiao.com/a7032302904794956325/
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋
上一篇:常见的PHP漏洞

最新评论

返回顶部