时在中春,阳和方起。阳和:春天的暖气。有时候,所有风景只为一个路人,或一个路过的人。一如那最初的爱情。
在纯php代码的脚本里如果想跳转到一个指定的网址页面,该如何做呢?下面就总结了三种常见的php中页面挑战的方法,非常的简单。
php 中实现页面跳转的方法
1、php 使用 header()函数 进行页面跳转
示例代码:
header('location:https://www.feiniaomy.com/');
2、php 利用 html 中的 meta 标签进行页面跳转
示例代码:
//延时3秒跳转 echo '<meta http-equiv="refresh" content="3;url=http://feiniaomy.com"> '; //直接跳转秒跳转 echo '<meta http-equiv="refresh" content="0;url=http://feiniaomy.com"> ';
3、php 利用 js 代码进行页面跳转
//直接跳转 echo "<script>window.location.href = 'http://feiniaomy.com';</script>"; //延迟三秒跳转 echo "<script>setTimeout(\"window.location.rel="nofollow" href='http://feiniaomy.com'\",3000);</script>";
本文php如何实现页面跳转的方法到此结束。勤奋能够弥补聪明的不足,但聪明无法弥补懒惰的缺陷。小编再次感谢大家对我们的支持!