|
1
|
<
meta
http-equiv
=
"Refresh"
content
=
"3;url=other.php"
/>
|
立即跳转:
|
1
2
3
|
header(
'Location:other.php'
);
//file_put_contents('bee.txt','execute');
die
;
|
|
1
2
3
4
|
header(
'Refresh:3,Url=other.php'
);
echo
'3s 后跳转'
;
//由于只是普通页面展示,提示的样式容易定制
die
;
|
封装的跳转函数:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
function
jump(
$url
,
$info
=null,
$sec
=3)
{
if
(
is_null
(
$info
)){
header(
"Location:$url"
);
}
else
{
// header("Refersh:$sec;URL=$url");
echo
"<meta http-equiv=\"refresh\" content="
.
$sec
.
";URL="
.
$url
.
">"
;
echo
$info
;
}
die
;
}
|
本文介绍了使用PHP进行页面跳转的几种方法,包括利用HTTP头部信息实现即时跳转及通过HTML元标签达到延迟跳转的效果,并提供了一个封装好的跳转函数。
1万+

被折叠的 条评论
为什么被折叠?



