探讨PHP页面跳转几种实现技巧


<ol class="dp-xml"><li class="alt"><span><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>??php?</span></span></li><li class="alt"><span><span>//重定向浏览器?</span></span></li><li class="alt"><span><span>header("Location:?http://bbs.lampbrother.net");?</span></span></li><li class="alt"><span><span>//确保重定向后,后续代码不会被执行?</span></span></li><li class="alt"><span><span>exit;</span></span></li><li class="alt"><span><span class="tag"><strong><span style="color: #006699;">?></span></strong></span><span>??</span></span></li></ol><ol class="dp-xml"><li class="alt"><span><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?</span><span class="tag-name"><strong><span style="color: #006699;">meta</span></strong></span><span>?</span><span class="attribute"><span style="color: #ff0000;">http-equiv</span></span><span>=</span><span class="attribute-value"><span style="color: #0000ff;">"refresh"</span></span><span>?</span></span></li><li class="alt"><span><span class="attribute"><span style="color: #ff0000;">content</span></span><span>=</span><span class="attribute-value"><span style="color: #0000ff;">"1;url=http://bbs.lampbrother.net"</span></span><span class="tag"><strong><span style="color: #006699;">></span></strong></span><span>?</span></span></li></ol>
<ol class="dp-xml"><li class="alt"><span><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>??php? ?</span></span></li><li><span>$</span><span class="attribute"><span style="color: #ff0000;">url</span></span><span>?=?</span><span class="attribute-value"><span style="color: #0000ff;">"http://bbs.lampbrother.net"</span></span><span>;?</span><span class="tag"><strong><span style="color: #006699;">?></span></strong></span><span>?</span></li><li class="alt"><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?</span><strong><span style="color: #006699;"><span class="tag-name">html</span><span class="tag">></span></span></strong><span>? ?</span></li><li><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?</span><strong><span style="color: #006699;"><span class="tag-name">head</span><span class="tag">></span></span></strong><span>? ?</span></li><li class="alt"><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?</span><span class="tag-name"><strong><span style="color: #006699;">meta</span></strong></span><span>?</span><span class="attribute"><span style="color: #ff0000;">http-equiv</span></span><span>=</span><span class="attribute-value"><span style="color: #0000ff;">"refresh"</span></span><span>?</span><span class="attribute"><span style="color: #ff0000;">content</span></span><span>="1; ?</span></li><li><span class="attribute"><span style="color: #ff0000;">url</span></span><span>=</span><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>??php?echo?$url;?</span><span class="tag"><strong><span style="color: #006699;">?></span></strong></span><span>"</span><span class="tag"><strong><span style="color: #006699;">></span></strong></span><span>? ?</span></li><li class="alt"><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?/head</span><span class="tag"><strong><span style="color: #006699;">></span></strong></span><span>? ?</span></li><li><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?</span><strong><span style="color: #006699;"><span class="tag-name">body</span><span class="tag">></span></span></strong><span>? ?</span></li><li class="alt"><span>页面只停留一秒……? ?</span></li><li><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?/body</span><span class="tag"><strong><span style="color: #006699;">></span></strong></span><span>?</span></li><li class="alt"><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?/html</span><span class="tag"><strong><span style="color: #006699;">></span></strong></span><span>??</span></li></ol>
<ol class="dp-xml"><li class="alt"><span><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>??php ?</span></span></li><li><span>$</span><span class="attribute"><span style="color: #ff0000;">url</span></span><span>?=?</span><span class="attribute-value"><span style="color: #0000ff;">"http://bbs.lampbrother.net"</span></span><span>; ?</span></li><li class="alt"><span>echo?"</span><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?</span><span class="tag-name"><strong><span style="color: #006699;">script</span></strong></span><span>?</span><span class="attribute"><span style="color: #ff0000;">language</span></span><span>=</span><span class="attribute-value"><span style="color: #0000ff;">'javascript'</span></span><span>?</span></li><li class="alt"><span class="attribute"><span style="color: #ff0000;">type</span></span><span>=</span><span class="attribute-value"><span style="color: #0000ff;">'text/javascript'</span></span><span class="tag"><strong><span style="color: #006699;">></span></strong></span><span>"; ?</span></li><li><span>echo?"</span><span class="attribute"><span style="color: #ff0000;">window.location.href</span></span><span>=</span><span class="attribute-value"><span style="color: #0000ff;">'$url'</span></span><span>"; ?</span></li><li class="alt"><span>echo?"</span><span class="tag"><strong><span style="color: #006699;"><</span></strong></span><span>?/script</span><span class="tag"><strong><span style="color: #006699;">></span></strong></span><span>"; ?</span></li><li><span class="tag"><strong><span style="color: #006699;">?></span></strong></span><span>?</span></li></ol>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号