• 作者:干啥呢
  • 积分:16790
  • 等级:专家教授
  • 2018/7/9 15:17:58
  • 楼主(阅读:1432/回复:0)PHP常用的跳转方式:

    [list=1][*]

    使用header函数跳转:将HTTP协议标头(header)输出到浏览器。示例如下:

    1

    2

    3

    4

    5

    <?php//重定向跳转header("Location: http://zhidao.baidu.com");exit;?>
    [*]

    使用Meta标签进行跳转;示例如下:

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    <?php //秒数$content=1;//跳转地址$url="http://zhidao.baidu.com";?><html>   <head>   <meta http-equiv='refresh' content="<?php echo $content;?>; url=<?php echo $url;?>">   </head>   <body>   meta标签跳转示例  </body> </html>
    [*]

    使用javascript跳转;示例如下:

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    <?php //地址$url = "http://zhidao.baidu.com";  //跳转echo('<script language="javascript">');echo("location.href='$url';");echo('</script>');exit; ?>
    [/list]


    目前不允许游客回复,请 登录 注册 发表言论。