php怎么实现3秒跳转页面
时间:2021-11-16 来源:互联网
今天PHP爱好者为您带来php实现3秒跳转页面的方法:1、使用“header('Refresh:3,Url=页面地址')”语句;2、使用“echo "<meta http-equiv='refresh' content='3; url=页面地址'>";”语句。希望对大家有所帮助。
本教程操作环境:windows7系统、PHP7.1版、DELL G3电脑
php实现3秒跳转页面的方法
1、使用Header函数
<?php
header("Content-type:text/html;charset=utf-8");
header('Refresh:3,Url=http://www.php.cn/'); //3s后跳转
echo '3s 后跳转';
//由于只是普通页面展示,提示的样式容易定制
die;
?>
2、使用echo输出meta
<?php
header("Content-type:text/html;charset=utf-8");
echo '3s 后跳转';
echo "<meta http-equiv='refresh' content='3; url=http://www.php.cn'>";
die;
?>
注意,content中的数字3的意思是经过多久开始跳转,这里设置的是3就是说要经过3秒钟该页面才会跳转到目标页面,建议大家在设置跳转时间的时候不要超过10秒。
以上就是php怎么实现3秒跳转页面的详细内容,更多请关注php爱好者其它相关文章!
-
Binance安全验证教程 2025-07-19
-
Binance新用户如何注册 2025-07-18
-
Binance网页版充值提现教程 2025-07-18
-
Binance手续费支付方式 2025-07-18
-
这就是为什么Caldera的ERA今天飙升超过120% 2025-07-18
-
分析师预测,若这些关键形态确认,XRP将占据27%的市场份额 2025-07-18