Php 警告:无法修改标题信息

Php 警告:无法修改标题信息,php,Php,我收到以下错误:警告:无法修改标题信息-标题已由第22行的/Applications/XAMPP/xamppfiles/htdocs/recover.php:11 in/Applications/XAMPP/xamppfiles/htdocs/recover.php上启动的输出发送 这是我的代码,您可以查看: <?php include 'core/init.php'; logged_in_redirect(); ?> <h1> Recover </h1&g

我收到以下错误:警告:无法修改标题信息-标题已由第22行的/Applications/XAMPP/xamppfiles/htdocs/recover.php:11 in/Applications/XAMPP/xamppfiles/htdocs/recover.php上启动的输出发送

这是我的代码,您可以查看:

<?php

include 'core/init.php';
logged_in_redirect();

?>


<h1> Recover </h1>

<?php
if (isset($_GET['success']) === true && empty($_GET['success']) === true) {
?>
    <p>thanks we have emailed you</p>
<?php
} else {
    $mode_allowed = array('username', 'password');
        if(isset($_GET['mode']) === true && in_array($_GET['mode'], $mode_allowed) === true) {
            if(isset($_POST['email']) === true && empty($_POST['email']) === false){
                if (email_exists($_POST['email']) === true) {
                    recover($_GET['mode'], $_POST['email']);
                    header('Location: recover.php?success');
                    exit();
                } else {
                    echo 'we cant find that email in our database';
                }
            }

?>
    <form action="" method="post">
        Please enter your email adress:<br>
        <input type="text" name="email"><br>
        <input type="submit" value="Recover!">


    </form>

<?php
    } else {
        header('Location: index.php');
        exit();
    }
}

?>
你知道我该怎么解决这个问题吗?
提前感谢

在PHP输出任何内容后,您不能更改标题信息,在您的情况下重定向


删除Recover将修复错误,但您应该重新考虑代码,以便标题“Location:Recover.php?success”;出现在任何HTML输出之前。

请执行javascript/meta刷新或删除if语句中的Recover和HTML。可能是php最具攻击性的三大功能之一……非常感谢您的帮助!: