PHP跳转代码的实现方法讲解
程序员文章站
2022-04-13 15:06:53
...
PHP跳转代码默认文档设置1 :
- ?php
- switch ($_SERVER["HTTP_HOST"])
- {
- case "www.a.com":
- header("location:a/index.php");
- break;
- case "www.b.com":
- header("location:b/index.php");
- break;
- case "www.c.com":
- header("location:c/index.php");
- break;
- }
- ?>
PHP跳转代码默认文档设置2 :
- ?php
- $HTTP_HOST=$_SERVER['HTTP_HOST'];
- if(($HTTP_HOST=="a.com")or
($HTTP_HOST=="www.a.com"))- {Header("Location:/index.html"); }
- elseif(($HTTP_HOST=="b.net")or
($HTTP_HOST=="www.b.net"))- {Header("Location: /kangbite/"); }
- elseif(($HTTP_HOST=="c.com")or
($HTTP_HOST=="www.c.com"))- {Header("Location: /c/"); }
- else
- {}
- ?>
以上就是PHP跳转代码的具体代码实现方法。