Home >Backend Development >PHP Tutorial >Explanation on how to implement PHP jump code_PHP tutorial

Explanation on how to implement PHP jump code_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:32:071020browse

PHP jump code default document setting 1:

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


The above is the specific code implementation method of PHP jump code.

<ol class="dp-xml"><li class="alt"><span><span class="tag"><</span><span> ?php  </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></span></li></ol>

http://www.bkjia.com/PHPjc/446165.html

www.bkjia.com


true

http: //www.bkjia.com/PHPjc/446165.html

PHP jump code default document setting 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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn