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

开发 后端
我们在这篇文章中为大家详细介绍了有关PHP页面自动跳转的实现方法,希望对又需要的朋友有所帮助。

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

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>
责任编辑:曹凯 来源: 新浪博客
相关推荐

2009-12-11 13:25:01

PHP页面跳转

2009-12-02 20:02:18

PHP实现页面跳转

2015-05-05 10:51:32

php页面跳转方法

2009-07-03 17:24:31

Servlet页面跳转

2009-12-02 19:08:19

PHP跳转代码

2009-12-24 17:57:53

WPF页面跳转

2009-12-01 16:34:21

PHP表单

2021-05-18 09:49:08

鸿蒙HarmonyOS应用

2009-12-16 17:24:26

Ruby on Rai

2009-12-08 10:50:12

PHP GD库实现中文

2009-11-30 18:46:51

PHP字符串颠倒顺序

2009-12-07 11:21:59

PHP生成缩略图

2009-12-10 13:14:26

PHP下拉框

2009-12-01 10:11:51

PHP自动获取关键词

2010-08-05 09:39:17

Flex页面跳转

2009-11-30 18:59:52

PHP数组排序

2009-11-23 10:31:25

PHP使用JSON

2009-11-25 15:35:24

PHP实现站内搜索引擎

2009-07-03 17:48:24

JSP页面跳转

2009-12-02 20:09:45

PHP页面跳转函数
点赞
收藏

51CTO技术栈公众号