当前位置:Gxlcms > PHP教程 > PHP跳转代码的实现方法讲解_PHP教程

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

时间:2021-07-01 10:21:17 帮助过:3人阅读

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跳转代码的具体代码实现方法。


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/446165.htmlTechArticlePHP跳转代码默认文档设置1 : ?php switch($_SERVER[HTTP_HOST]) { casewww.a.com: header(location:a/index.php); break; casewww.b.com: header(location:b/index.php); break; case...

人气教程排行