PHP中实现页面跳转

2014-01-25  60962阅

总结3种在PHP中常用的页面跳转方法,下面天涯[PHPHA.COM]做详细说明。
方法1: PHP中 header() 函数

<?php
header(“Location:http://wapzz.cn“);
?>

注意:
1. location 与 : 之间不能有空格,否则不会跳转。
2. header()前不能有任何的输出。
3. header()之后的PHP代码还会被执行。

方法2: Meta标签
Meta标签是HTML中负责提供文档元信息的标签,在PHP程序中使用该标签,也可以实现页面跳转。 若定义http-equiv为refresh,则打开该页面时将根据content规定的值在一定时间内跳转到相应页面。若设置content=”秒数;url=网址”,则定义了经过多长时间后页面跳转到指定的网址。
<html>
<head>
<meta http-equiv=“refresh“ content=“1;url=http://blog.0907.org“>
<title>HTML标题</title>
</head>
<content>
欢迎大家光临!
</content>
</html>

方法3: javascript实现
<script language=“javascript“ type=“text/javascript“>
location.href = “http://wapzz.cn“;
</script>

发表评论

文明评论,重在参与

128楼 游客33706:
you will soon|it’s easy to|you may invariably
[ *=http://www.shopisla.com/Indians-33-Nick-Swisher-Grey-Cool-Base-Embroidered-Baseball-Jersey-5946]Philips Sports Union Jerseys[/*]07-22 00:24
127楼 游客85722:
you wish to GSfuyjfghr2015|you intend to GSfuyjfghr2015|you would like to GSfuyjfghr2015|you want to GSfuyjfghr2015|you need to GSfuyjfghr2015|you desire to
[ *=http://www.americasboatingcourse.com/Search.cfm?news=cheap-nike-air-max-hyperfuse-independence-day.html]Cheap Nike Air Max Hyperfuse Independence Day[/*]07-21 20:39
126楼 游客04727:
zealous|fervent
[ *=http://www.sanfranciscoantiquemall.com/shop.cfm?search=Cheap-Oakley-Sunglasses-page-8.html]Cheap Oakley Sunglasses page 8[/*]07-20 17:51
125楼 游客95050:
you will soon GSfuyjfghr2015|it’s easy to GSfuyjfghr2015|you may invariably
[ *=http://www.datetoplay.com/amazon.cfm?search=Cheap-Oakley-Sunglasses-page-1.html]Cheap Oakley Sunglasses page 1[/*]07-20 14:40
124楼 游客24048:
you will not GSfuyjfghr2015|you won’t GSfuyjfghr2015|you’ll not GSfuyjfghr2015|you do not GSfuyjfghr2015|you simply won’t GSfuyjfghr2015|you won’t need to GSfuyjfghr2015|you simply will not GSfuyjfghr2015|you shall not GSfuyjfghr2015|you may not GSfuyjfghr2015|no one will GSfuyjfghr2015|you won’t GSfuyjfghr2015|you might not GSfuyjfghr2015|that you simply won’t GSfuyjfghr2015|you’ll not be GSfuyjfghr2015|will not likely GSfuyjfghr2015|you simply won’t be GSfuyjfghr2015|you can’t GSfuyjfghr2015|do not GSfuyjfghr2015|shipment GSfuyjfghr2015|you will GSfuyjfghr2015|you GSfuyjfghr2015|shipping and delivery
[ *=http://www.datetoplay.com/amazon.cfm?search=Cheap-Oakley-Sunglasses-news-1xlPB4.html]Cheap Oakley Sunglasses[/*]07-20 07:03
最新文章
你真的需要智能手环么? 09-01
微信真能给微信读书带来巨大红利 09-01
网络文化不过是新生代心理活动投 09-01
左手微票右手时光,万达在下一步 09-01
在知乎,如何写一个烂答案? 09-01
单机游戏的未来:VR技术或将助 09-01
宗宁:史上最无情广告法终结传统 09-01
iPhone 还是 Andro 09-01
互联网让偷情变得越来越容易了吗 09-01
“跑分”大潮退去 谁在裸泳? 09-01
返回PHP教程-返回首页
2009-2018 版权所有 1159.com.cn pc