首页 > php框架 > PHP跳转代码的实现方法讲解

PHP跳转代码的实现方法讲解

PHP跳转代码默认文档设置1 :

  1. < ?php   
  2. switch ($_SERVER["HTTP_HOST"])   
  3. {   
  4. case "www.a.com":   
  5. header("location:a/index.php");   
  6. break;   
  7. case "www.b.com":   
  8. header("location:b/index.php");   
  9. break;   
  10. case "www.c.com":   
  11. header("location:c/index.php");   
  12. break;   
  13. }   
  14. ?>   


PHP跳转代码默认文档设置2 :
 

  1. < ?php  
  2. $HTTP_HOST=$_SERVER[HTTP_HOST];   
  3. if(($HTTP_HOST=="a.com")or
    ($
    HTTP_HOST=="www.a.com"))  
  4. {Header("Location:/index.html"); }  
  5. elseif(($HTTP_HOST=="b.net")or
    ($
    HTTP_HOST=="www.b.net"))  
  6. {Header("Location: /kangbite/"); }  
  7. elseif(($HTTP_HOST=="c.com")or
    ($
    HTTP_HOST=="www.c.com"))  
  8. {Header("Location: /c/"); }  
  9. else  
  10. {}  
  11. ?>   

以上就是PHP跳转代码的具体代码实现方法。


教程地址:http://www.phprm.com/frame/php1003806.html

欢迎转载!但请带上文章地址^^

标签:none

发表留言