Rumah >pembangunan bahagian belakang >tutorial php >PHP跳转代码的实现方法讲解_PHP教程
PHP跳转代码默认文档设置1 :
PHP跳转代码默认文档设置2 :
<ol class="dp-xml"> <li class="alt"><span><span class="tag"><span> ?php </span></span></span></li> <li> <span>$</span><span class="attribute">HTTP_HOST</span><span>=$_SERVER['HTTP_HOST']; </span> </li> <li class="alt"> <span>if(($</span><span class="attribute">HTTP_HOST</span><span>=="a.com")or<br>($</span><span class="attribute">HTTP_HOST</span><span>=="www.a.com")) </span> </li> <li><span>{Header("Location:/index.html"); } </span></li> <li class="alt"> <span>elseif(($</span><span class="attribute">HTTP_HOST</span><span>=="b.net")or<br>($</span><span class="attribute">HTTP_HOST</span><span>=="www.b.net")) </span> </li> <li><span>{Header("Location: /kangbite/"); } </span></li> <li class="alt"> <span>elseif(($</span><span class="attribute">HTTP_HOST</span><span>=="c.com")or<br>($</span><span class="attribute">HTTP_HOST</span><span>=="www.c.com")) </span> </li> <li><span>{Header("Location: /c/"); } </span></li> <li class="alt"><span>else </span></li> <li><span>{} </span></li> <li class="alt"> <span class="tag">?></span><span> </span> </li> </ol>
以上就是PHP跳转代码的具体代码实现方法。