php一句代码让http跳转https
2021-05-01 23:27
标签:cat off 加载 rman server perm || moved php php一句代码让http跳转https 标签:cat off 加载 rman server perm || moved php 原文地址:https://www.cnblogs.com/trip-j/p/php.html//其他框架请加到入口某共公加载的文件中
//方法一 https状态
if(!isset($_SERVER[‘HTTPS‘]) || $_SERVER[‘HTTPS‘] == ‘off‘){
Header("HTTP/1.1 301 Moved Permanently");
header(‘Location: https://‘.$_SERVER[‘HTTP_HOST‘].$_SERVER[‘REQUEST_URI‘]);
}
//方法二 判断端口
if($_SERVER[‘SERVER_PORT‘]=="80"){
Header("HTTP/1.1 301 Moved Permanently");
header(‘Location: https://‘.$_SERVER[‘HTTP_HOST‘].$_SERVER[‘REQUEST_URI‘]);
}
文章标题:php一句代码让http跳转https
文章链接:http://soscw.com/index.php/essay/81072.html