header()自动移动我

时间:2018-03-01 23:05:10

标签: php jquery ajax

AJAX:

$.ajax(
                {
                    type: "POST",
                    url: "validate.php",
                    data: {password: password},
                    success:
                    function(data)
                    {
                        if(data == "1")
                        {
                            alert("password c.");
                            var header = "<?php header('Location: administration.php'); ?>";
                            alert(header);
                        }
                        else
                        {
                            alert("password - inc.");
                        }
                    }
                });

validate.php:

<?php
if(isset($_POST["password"]))
{
    $password = $_POST["password"];

    if($password == "0000")
    {
        echo("1");
    }
    else
    {
        echo("0");
    }
}

&GT;

如果我想从administration.php返回到index.php,函数header()会自动将我移动到索引。为什么?如何输入密码后才能进行移动?所以即使我从administration.php转到index.php,也必须输入密码。

0 个答案:

没有答案