在一个页面如login.php判断登录成功后,想直接显示另一个网页如主页index.php,有什么函数可以实现?

解决方案 »

  1.   

    一般都是header()函数来指示浏览器跳转到其它页面。当然,也可以用JS,或者干脆服务器端的PHP来代替浏览器载入该页面。
      

  2.   


    <div>
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    <p>
    <strong> 
    <span id="span_text">系统会在
    <span id="span_timer">3</span>秒后,自动跳转到如下网址:ַ</span>
    </strong> 
    <br />
    <a id="a_url" href="http://topic.csdn.net/u/20120315/13/1a3ed0fb-f688-4a69-9845-f94d7c168a5b.html" class="font_red">
    http://topic.csdn.net/u/20120315/13/1a3ed0fb-f688-4a69-9845-f94d7c168a5b.html
    </a>
    <br />
    </p>
    <div id="collocate" style="display: none">
    <script type="text/javascript">
        (function() {
            var total = 3; 
            var span_timer = document.getElementById("span_timer");
            span_timer.innerHTML = total;
            var timer = setInterval(function() {
                if (total <= 0) {
                    location.href = document.getElementById("a_url").href; 
                    clearInterval(timer);
                    timer = 0;
                } else span_timer.innerHTML = --total;
            }, 1000);         
        })();
    </script>
    </div>
    </div>csdn的
      

  3.   

    方法一:<?php
    $GoTo="index.php";// 如果这里的目标链接取自数据库就实现了动态转向
    header(sprintf("Location: %s", $GoTo));
    ?>方法二:<?php echo "<script>window.location =\"$PHP_SELF\";</script>";?>
    方法三:<?php echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=index.php\">";?>
      

  4.   

    上面说的还很详细的,googel下全都有的。