你了解PHP中重定向网页跳转页面的方法有哪些吗?
发布时间:2022-07-16 15:54:09 所属栏目:PHP教程 来源:互联网
导读:今天的这篇文章,会继续带领大家学习PHP中重定向网页跳转页面的方法,相信你们看完这篇文章一定会有很多收获,话不多说,让我一起看看吧! ?php header(content-type:text/html;charset=uft-8); //重定向页面 header(location:index.php); ? 第二种:利用HTM
|
今天的这篇文章,会继续带领大家学习PHP中重定向网页跳转页面的方法,相信你们看完这篇文章一定会有很多收获,话不多说,让我一起看看吧! <?php header('content-type:text/html;charset=uft-8); //重定向页面 header('location:index.php'); ?> 第二种:利用HTML 头部中的 meta标签,定义http-equiv=refresh 和content=”跳转花费的时间(秒为单位);url=跳转地址” <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> //跳转页面,跳转时间:3秒钟,目标地址:index.php <meta http-equiv="refresh" content="3;url=index.php"> <title>skip...</title> </head> 或者 <?php header('content-type:text/html;charset=utf-8'); $url='index.php'; <head> <meta charset="UTF-8"> //跳转页面,跳转时间:2秒钟,目标地址:index.php <meta http-equiv="refresh" content="2;url=<?php echo $url; ?>"> <title>skip...</title> </head> 第三种:利用javascript进行跳转 <?php header('content-type:text/html;charset=utf-8'); $url='index.php'; //立即跳转至目标页面 echo <script>window.location.href='$url';</script>; ?> 以上就是PHP中重定向页面的三种方法。 (编辑:应用网_丽江站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |



浙公网安备 33038102330468号