<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_35141"> 在PHP运行开始时,检验是否位HTTPS链接,若不是则跳转 <br> <br> <br> <br> <br> <div class="blockcode"> <div id="code_QKL"><ol> <li>switch (TRUE) {</li> <li> case (!isset($_SERVER['HTTPS'])) :</li> <li> case ($_SERVER['HTTPS']!="on") :</li> <li> RedirectToHttps();</li> <li> break;</li> <li>}</li> </ol></div> <em onclick="copycode($('code_QKL'));">复制代码</em> </div> <br> <br> <br> <div class="blockcode"> <div id="code_q3V"><ol> <li>function RedirectToHttps(){</li> <li> $redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];</li> <li> header("Location:$redirect");</li> <li> exit;</li> <li>}</li> </ol></div> <em onclick="copycode($('code_q3V'));">复制代码</em> </div> </td></tr></table> <div id="comment_35141" class="cm"> </div> <div id="post_rate_div_35141"></div> <br><br>