PHP标头和刷新无法正常工作

Sas*_*u H 1 php refresh header

我的服务器在PHP 5.2.9中运行,当我使用刷新和标头功能时,它无法正常工作.这是我的代码

header("location: index.php");

header( "Refresh: 0;" );
Run Code Online (Sandbox Code Playgroud)

以前我在不同的服务器上工作,它工作正常.我怎么解决这个问题?

这是我的完整代码

if($_POST['sign_in'])
{
    $email = $_POST['email'];
    $password = $_POST['password'];
    $sql = "SELECT * FROM tbl_members WHERE m_email='$email' and m_password='$password'";
    $res = mysql_query($sql);
    $count = mysql_num_rows($res);
    if($count==1)
    {
        session_register("email");
        header("location: index.php");
    }
    else
    {
        $sql = "SELECT * FROM tbl_temp_members WHERE email='$email'";
        $res = mysql_query($sql);
        $count = mysql_num_rows($res);
        if($count==1)
        {
            echo "Login unsuccessful,Account still not activated";  
        }
        else
        {
            echo "Login unsccessful";
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

cem*_*cem 5

位置和刷新都需要绝对URI(它是"位置"而不是"位置").

试试这个:

header('Location: http://absolute.uri/file.ext');
Run Code Online (Sandbox Code Playgroud)

如果这没有帮助,请检查我的答案是否有任何"奇怪的"PHP问题 ;)

  • 那是错的.它不需要是绝对的uri. (3认同)