Home  >  Article  >  php教程  >  推荐几种PHP实现页面跳转的方法

推荐几种PHP实现页面跳转的方法

WBOY
WBOYOriginal
2016-06-13 11:09:181363browse

1.PHP实现页面跳转第一种方法

  1. php 
  2. header("Location:http:
    //www.baidu.com");  
  3. ?> 

header()是php内置函数,用于实现页面跳转。

2.PHP实现页面跳转第二种方法:利用

<ol class="dp-xml">
<li class="alt"><span><span>jsecho "  </span></span></li>
<li><span class="tag"><span> </span><span class="tag-name">script</span><span> </span><span class="attribute">language</span><span>=</span><span class="attribute-value">"javascript"</span><span class="tag">></span><span>";  </span></span></li>
<li class="alt">
<span>echo "</span><span class="attribute">location.href</span><span>=</span><span class="attribute-value">'www.abidu.com'</span><span>";  </span>
</li>
<li><span>echo "  </span></li>
<li class="alt"><span class="tag"><span> /script</span><span class="tag">></span><span>"; </span></span></li>
</ol>

3.PHP实现页面跳转第三种方法(利用HTML方法实现页面跳转,该方法较为实用,可以设置刷新时间,推荐使用。)

<ol class="dp-xml">
<li class="alt"><span><span>echo  </span></span></li>
<li>
<span> ("</span><span class="attribute">http-equiv</span><span>='refresh'<br></span><span class="attribute-value">content</span><span>=0;</span><span class="attribute">URl</span><span>=</span><span class="attribute-value">'hehe.html'</span><span>"); </span>
</li>
</ol>

1.若是跳转到其它页面可以加上参数 index.php?id=4action=add2.取出其它页面以后参数

<ol class="dp-xml">
<li class="alt"><span><span>$</span><span class="attribute">id</span><span> = $_GET[id]; </span></span></li>
<li class="alt"><span><span>$</span><span class="attribute">action</span><span>=$_GET[action]; </span></span></li>
</ol>

以上就是PHP实现页面跳转的具体方法。


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