Home  >  Article  >  Backend Development  >  Introduction to the specific implementation method of redirecting web pages in PHP_PHP tutorial

Introduction to the specific implementation method of redirecting web pages in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:31:16801browse

For beginners, PHP Redirect Web Page Method 1:

Send http header information to the page to implement redirection. The following are quoted Content:

  1. php
  2. $GoTo="index.php";
  3. // If the target link here is taken from The database realizes dynamic steering
  4. header(sprintf("Location: %s", $GoTo));
  5. ?>

PHP redirect web page method two:

Use javascript script to redirect the page

The following is the quoted content:

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><</span><span> ?php   </span></span></li><li><span>echo "  </span></li><li class="alt"><span class="tag"><</span><span> </span><span class="tag-name">script</span><span class="tag">></span><span class="attribute">window.location</span><span> =  </span></span></li>
<li><span>"$PHP_SELF";  </span></li>
<li class="alt">
<span class="tag"><</span><span> /script</span><span class="tag">></span><span>";  </span>
</li>
<li>
<span class="tag">?></span><span>  </span>
</li>
</ol>

PHP method three for redirecting web pages:

Use html meta tags to redirect pages

The following is the quoted content:

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><</span><span> ?php   </span></span></li><li><span>echo "  </span></li><li class="alt"><span class="tag"><</span><span class="tag-name">META</span><span> </span><span class="attribute">HTTP-EQUIV</span><span>=  </span></li><li><span>"Refresh" </span><span class="attribute">CONTENT</span><span>="0;  </span></li><li class="alt"><span class="attribute">URL</span><span>=</span><span class="attribute-value">index</span><span>.php"  </span></li><li><span class="tag">></span><span>";  </span></span></li>
<li class="alt">
<span class="tag">?></span><span>  </span>
</li>
</ol>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446231.htmlTechArticleFor beginners, PHP redirect web page method one: Send http header information to the page to achieve redirection. The following is Quoted content: ?php $GoTo = index.php; //If the target link here...
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