php头重定向不';行不通

php头重定向不';行不通,php,html,redirect,header,Php,Html,Redirect,Header,我已经创建了一个邮件表单。PHP页面读取输入,将其发送到邮件,然后重定向到某个页面。很直接,以前做过。邮件会被发送,但不会被重定向 HTML格式: <form action="mailversturen.php" method="post"> <input type="text" name="naam" placeholder="Naam" class="inputtype" /><br /> <input type="text" name="email

我已经创建了一个邮件表单。PHP页面读取输入,将其发送到邮件,然后重定向到某个页面。很直接,以前做过。邮件会被发送,但不会被重定向

HTML格式:

<form action="mailversturen.php" method="post">
<input type="text" name="naam" placeholder="Naam" class="inputtype" /><br />
<input type="text" name="email" placeholder="Email" class="inputtype" /><br />
<textarea name="bericht" placeholder="Bericht"></textarea>
<input type="reset" value="Reset" class="buttontype" />
<input type="submit" value="Verstuur" class="buttontype" />
</form>



PHP代码:

<?php
$name = $_POST['naam'];
$email = $_POST['email'];
$message = $_POST['bericht'];

$to = "name@domain.com";
$subject = "Bericht van $name";
$headers = "From: $email \r\n";

mail($to,$subject,$message,$headers);

header('Location: http://www.newlocation.nl/');
?>


我做错了什么?

尝试添加
@ob_start()打开后
键入退出;在标题()之后;您可能在
之前有一些空格,或者正在发出某种通知任何php错误/警告?。这是一个很好的解释。如果有过早的输出,那么添加ob_start已经太迟了。