<?PHP header(location:URL地址) ?>
例如 <?PHP header(location:helloworld.PHP)?> 页面会立即跳转,因为header执行了location重定向
延迟跳转(比如登陆成功后会有几秒钟等待时间,然后跳转到了其他页面)
<?PHP header(Refresh:秒数;url=地址) ?>
例如 <?PHP header(Refresh:3;url=helloworld.PHP)?> 会在3秒后执行跳转
<?PHP sleep(3); header(location:URL地址)?> 调用了sleep()方法,效果也是x秒后执行跳转
在js脚本代码中实现
1.window.location.href方法
<script type=text/javascript> window.location.href=helloworld.PHP </script>
<script type=text/javascript> setTimeout(window.location.href='helloworld.PHP',3000); </script>
2.window.location.assign方法 延迟跳转方法同上
<script type=text/javascript> window.location.assign(helloworld.PHP); </script>
3.window.location.replace方法 (让新页面替换掉当前页面,不会保存在历史记录里,所有不能使用浏览器后退到原页面了)
<script type=text/javascript> window.location.replace(helloworld.PHP); </script>
4.window.open方法 三个参数,第一个URL地址。第二个打开新页面方式(比如新页面_blank,_new,自身跳转_self),第三个是新页面的方式,包括样式,位置等。
<script type=text/javascript> window.open(index.PHP,_blank,width=300px); </script>
直接插入这句代码就可以
<Meta http-equiv=refresh content=3;url='helloworld.PHP'>
花式实现相关跳转,你值得拥有
推荐学习:PHP
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。