探讨PHP页面自动跳转的实现方法 - Go语言中文社区

探讨PHP页面自动跳转的实现方法


PHP页面自动跳转的实现对于PHP新手来说还是比较陌生的,希望通过对本文的理解,能够提高我们的实际编程能力,对PHP页面自动跳转的实现方法有一个深刻的了解。

1.meta 标签实现跳转:

<meta http-equiv="refresh" content="秒; url=下一个页面">

2 .JavaScript实现跳转:

  1. < script language="JavaScript">
  2. var userAgent = navigator.userAgent;
  3. var MSIEIndex = userAgent.indexOf("MSIE");
  4. if (userAgent.indexOf("Win") != -1 &&
  5. userAgent.indexOf("MSIE") != -1 &&
  6. userAgent.substring((MSIEIndex + 5),(MSIEIndex + 8)) >= 5.5)
  7. window.location.replace("http://www.shuigong.com");
  8. //-->
  9. < /script>

3 假如访问网站时,直接进入某个子目录中的文件,如cgi-bin/leoboard.cgi,这时,只要写一个默认的首页文件如index.htm,内容如下,就可以实现你的要求.

PHP页面自动跳转方法一:

  1. < html>
  2. < head>
  3. < title>网页跳转< /title>
  4. < meta http-equiv="refresh" content="0;url=cgi-bin/leoboard.cgi">
  5. < /head>
  6. < body>
  7. < /body>
  8. < /html>

PHP页面自动跳转方法二

  1. <html>
  2. < head>
  3. < title>正在进入>>> Loading>>> < /title>
  4. < /head>
  5. < body bgcolor="#FFFFFF" text="#000000">
  6. < p> < /p>< tr> <td width=724>
  7. < p align=center><font color="red" size="2">
    正在进入,请等待,谢谢......< /font>< /p>< /td>< /tr>< tr>
  8. < td width="724">
  9. < p align=center>
  10. < form name=loading>
  11. < div align=center>
  12. < p>
  13. < input type=text name=chart size=46
    tyle
    ="font-family:Arial; font-weight:
    bolder; color:rgb(124,119,119);
    background-color:white; padding:0px;
    border-style:none;"
    >
  14. < br>< input type=text name=percent
    size=46 style="color:rgb(138,134,134);
    text-align:center; border-width:medium;
    border-style:none;"
    ><script>var bar = 0
  15. var line = "||"
  16. var amount ="||"
  17. count()
  18. function count(){
  19. barbar= bar+2
  20. amountamount =amount + line
  21. document.loading.chart.value=amount
  22. document.loading.percent.value=bar+"%"
  23. if (bar<99)
  24. { setTimeout("count()",10); }
  25. else
  26. { window.location = "http://www.wwwfox.net/cgi-bin/leoboard.cgi"; }
  27. }< /script>
  28. < / body>
  29. < /html>

实现PHP页面自动跳转的代码

1:

  1. < script language="j avascript">
  2. location.replace
    ("http://www.***.com")
  3. < /script>

2:

  1. < script language="j avascript">
  2. setTimeout(window.location=
    "http://www.dinmo.net",0)
  3. < /script>

3:

  1. < script language="JavaScript" >
  2. bName = navigator.appName;
  3. if ((bName == "Netscape") ||
  4. (bName == "Microsoft Internet Explorer"))
  5. window.location=http://www.dinmo.net;
  6. < /script>
  7. < FRAMESET rows='*'>
  8. < FRAMESET cols='*'>
  9. < FRAME SRC='http://www.dinmo.net'>
  10. < noframes>

JS实现跳转代码_多域名指向同一空间

  1. < script>try { if( self.location == "http://玉米一/" ) {
  2. top.location.href = "http://玉米一/目录";
  3. }
  4. else if( self.location == "http://玉米二/" ) {
  5. top.location.href = "http://玉米二/目录";
  6. }
  7. else if( self.location == "http://玉米三/" ) {
  8. top.location.href = "http://玉米三/目录";
  9. }
  10. else if( self.location == "http://玉米四/" ) {
  11. top.location.href = "http://玉米四/目录";
  12. }
  13. else { document.write ("错误的访问地址") } } catch(e) { }
  14. < /script>
【责任编辑:曹凯 TEL:(010)68476606】

点赞 0
版权声明:本文来源51CTO,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:http://developer.51cto.com/art/200912/166406.htm
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2021-05-16 23:06:18
  • 阅读 ( 578 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢