PHP标题(“Location:bla”)已经存在

时间:2018-02-15 17:05:12

标签: php

我有一个问题。当我想登录我的网站时,我收到一个非常奇怪的错误,“警告:无法修改标题信息 - 已经在第44行的脚本中发送的标题(在脚本:29处开始输出)”

<?php
$verhalten = 0;
include("connect.php");

if(!isset($_SESSION["email"]) and !isset($_GET["page"]))  {
$verhalten = 0;
}
if (isset($_GET["page"]) && ($_GET["page"]) == "log") {

$user = $_POST["user"];
$passwort = md5($_POST["passwort"]);
}
?>


if($email == $row->Email && $pass_hash == $row->Passwort)
    {

        header("Location: such_form_kunden.php?ID=$row->Kundennr");
        $_SESSION["email"] = $email;
        $verhalten = 1;
        exit;
    }

1 个答案:

答案 0 :(得分:0)

尝试这样做可能会有效。

if (headers_sent()) {
    die("Redirect failed. Please click on this link: <a href=...>");
}
else{
    exit(header("Location: /user.php"));
}