Home >php教程 >php手册 >PHP重定向网页的具体实现方法介绍

PHP重定向网页的具体实现方法介绍

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:08:131048browse

对于初学者来说,PHP重定向网页方法一:

向页面发送http头信息实现重定向 以下为引用的内容:

  1.  php   
  2. $GoTo="index.php";  
  3. // 如果这里的目标链接取自数据库就实现了动态转向   
  4. header(sprintf("Location: %s", $GoTo));   
  5. ?>   

PHP重定向网页方法二:

用javascript 脚本实现页面的重定向

以下为引用的内容:

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

PHP重定向网页方法三:

用html 的meta标签实现页面的重定向

以下为引用的内容:

<ol class="dp-xml">
<li class="alt"><span><span class="tag"><span> ?php   </span></span></span></li>
<li><span>echo "  </span></li>
<li class="alt"><span class="tag"><span class="tag-name">META</span><span> </span><span class="attribute">HTTP-EQUIV</span><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>
</li>
<li class="alt">
<span class="tag">?></span><span>  </span>
</li>
</ol>


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