zoukankan      html  css  js  c++  java
  • 用php实现跳转的几种方式

    来源:https://www.cnblogs.com/du892294464/p/6835277.html

    php实现页面跳转有几种方式:

    一、在php脚本中实现

    1  <?php  header("location:url地址") ?>   
    2 // <?php  header("location:helloworld.php")?> 页面会立即跳转,因为header执行了location重定向

      延迟跳转(比如登陆成功后会有几秒钟等待时间,然后跳转到了其他页面)

    1 <?php header("Refresh:秒数; url=地址") ?> 
    2 // <?php header("Refresh:3; url='helloworld.php' ")?> 会在3秒后执行跳转
    3 <?php sleep(3); header("location:url地址") ?>  
    4 // 调用了sleep()方法,效果也是x秒后执行跳转

    二、在js脚本代码中实现

      1. window.location.href 方法

    1 <script type="text/javascript">
    2     window.location.href="helloworld.php"          
    3 </script>

      使用js方法实现延迟跳转

    1 <script type="text/javascript">
    2     setTimeout("window.location.href='helloworld.php'",3000);
    3 </script>

      2. window.location.assign 方法,延迟跳转方法同上

    1 <script type="text/javascript">
    2     window.location.assign("helloworld.php");
    3 </script>

      3. window.location.replace方法,(让新页面替换掉当前页面,不会保存在历史记录里,所有不能使用浏览器后退到原页面了)

    1 <script type="text/javascript">
    2     window.location.replace("helloworld.php");
    3 </script>

      4.window.open方法,三个参数,第一个URL地址。第二个打开新页面方式(比如新页面_blank,_new,自身跳转_self),第三个是新页面的方式,包括样式,位置等。

    1 <script type="text/javascript">
    2     window.open("index.php",_blank,width=300px);
    3 </script>

    三、使用HTML脚本代码完成跳转

    1 <meta http-equiv="refresh" content="3;url='helloworld.php'"> 

      在<head>标签里执行代码,直接插入这句代码就可以

  • 相关阅读:
    哈希表
    跳表
    哈夫曼之谜
    选择树、判定树和查找树

    将gbk字符串转换成utf-8,存储到注册表中后,再次从注册表读取转换成gbk,有问题!!!
    函数内部还是不要使用 strtok()
    没想到: System.out.println(n1 == f1 ? n1 : f1);
    在不同DPI屏幕环境下,让图标显示的尺寸保持不变,使用 LoadImage() 加载图标
    在多线程中显示模态窗口,出现异常现象
  • 原文地址:https://www.cnblogs.com/wsybky/p/8575810.html
Copyright © 2011-2022 走看看