/**
* 判断是否SSL协议
* @return boolean
*/
function is_ssl() { if(isset($_SERVER[‘HTTPS‘]) && (‘1‘ == $_SERVER[‘HTTPS‘] || ‘on‘ == strtolower($_SERVER[‘HTTPS‘]))){ return true; }elseif(isset($_SERVER[‘SERVER_PORT‘]) && (‘443‘ == $_SERVER[‘SERVER_PORT‘] )) { //https使用端口443 return true; } return false; }
1.$_SERVER[‘SERVER_PORT‘]获取https端口
2.https端口443 http端口80
时间: 2024-12-14 13:05:06