-1

可能重复:
PHP 已发送的标头

    if ($_SERVER['REQUEST_METHOD'] == 'POST') 
    {   
include 'verify.php';
$verify = new Verify();
$vali = $verify->VerifyUserLogin($_POST['UserEmail'], $_POST['Password']);
if($_SESSION['umUser'] == true)
{
    header("Location: ../index.php");

}
else
{
    $errorLogin = $_SESSION['loginForm'];
}
    }


                    function VerifyUserLogin($userEmail, $password)
                {
            $this->connect();
            $pass = md5($password);
            $result = mysql_query("SELECT * FROM umuser where umUserIsAdmin = 1 and umUserEmail = '".mysql_real_escape_string($userEmail)."' and umUserPassword = '".mysql_real_escape_string($pass)."'");
            if (mysql_num_rows($result) > 0)
            {
        while($row = mysql_fetch_array($result))
        {
            $_SESSION['umAnanymousGid'] = $row['umUserGID'];
            $_SESSION['umUserName'] = $row['umUserName'];
            $_SESSION['umUserEmail'] = $row['umUserEmail'];
            $_SESSION['umUserId'] = $row['umUserID'];
            $_SESSION['umUser'] = true;
        }


        //echo $_SESSION['umUser'];
        //header('Location:../');

    }

问题是它没有重定向到位置并生成警告警告:无法修改标头信息 - 标头已发送(输出开始于 ....)

请帮助

谢谢

4

1 回答 1

0

你可以做:

<?php
ob_start();
/**
content of your page
*/
ob_end_flush();
?>

或者您可以测试 $_SESSION 的长度(计数),如果它为空,那么任何会话都是打开的

于 2012-09-25T21:41:49.650 回答