为什么我的页面仍在执行?

Liz*_*ard 0 php header

我有一个表单发布到处理脚本,检查帖子中的错误.根据处理,它的标题重定向到另一个位置.这似乎工作,但我刚刚注意到仍然在标题后执行的东西.

到底是怎么回事?

Liz*_*ard 11

我们需要一些代码,以确切了解发生了什么......

但很可能你肯定不使用exit(); 或者死(); 标题后面("位置:...");

例如

//check your post

if($errors)
{
    header("Location: errors.php"); // bug fixed =D
    exit();

    // this will still be executed if the exit was not there.
}
Run Code Online (Sandbox Code Playgroud)