好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php访问http变成https解决办法

http直接跳转为https,重定向一下就可以了。用php就更简单了:

<?php header("Location:https://HdhCmsTestnowamagic测试数据"); ?>

当访问 http 时,跳 https:

<?php //http转化为https    if ($_SERVER["HTTPS"] <> "on") { $xredir="https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; header("Location: ".$xredir); } ?>

当访问 https 时,跳 http:

<?php //https转化为http    if ($_SERVER["HTTPS"] == "on")   {   $xredir="http://".$_SERVER["SERVER_NAME"]. $_SERVER["REQUEST_URI"];   header("Location: ".$xredir);   }    ?>

在网页开头包含上面代码即可。

查看更多关于php访问http变成https解决办法的详细内容...

  阅读:40次