php怎么实现3秒跳转页面
- 建站笔记
- 2022-05-11
- 571
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.bailiuli.com/'); //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.bailiuli.com'>"; die; ?>
注意,content中的数字3的意思是经过多久开始跳转,这里设置的是3就是说要经过3秒钟该页面才会跳转到目标页面,建议大家在设置跳转时间的时候不要超过10秒。
本文由白琉璃于2022-05-11发表在白琉璃源码网,如有侵权或疑问,请联系我们,谢谢。
本文链接:https://www.bailiuli.com/t/2844.html
上一篇
php怎么去掉前导0
发表评论