我相信你們都知道了這個錯誤:不能修改與郵件()和頭()PHP由ob_start()頭信息
Warning: Cannot modify header information - headers already sent by (output started at /homepages/4/d374499247/htdocs/wp-content/themes/tyler/mail.php:1) in /homepages/4/d374499247/htdocs/wp-content/themes/tyler/mail.php on line 34
這是代碼:
if (strpos($email,'@') !== false) {
ob_start();
mail($to,$subject,$message,$headers);
header("Location: thankyou.html");
ob_end_flush(); }
任何人都可以在這裏提供任何幫助嗎?我只是希望它的mail()的信息,然後轉至位置頁
編輯:這裏是整個代碼..
<?php
$to = '[email protected]';
$subject = 'בקשת הצטרפות לרשימת תפוצה';
$message =
'בקשת הצטרפות לרשימת תפוצה' . "\n\n" .
'שם: ' . $_REQUEST['name'] . "\n\n" .
'דואר אלקטרוני: ' . $_REQUEST['email'];
$email = $_REQUEST['email'];
$headers = 'From: ' . $email . "\r\n" .
'Reply-To: ' . $email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/plain; charset=ISO-8859-1";
// server-validation
if (strpos($email,'@') !== false){
mail($to,$subject,$message,$headers);
header("Location: thankyou.html");
} else {
echo "<p class='error'>כתובת הדוא'ל שגויה.</p>";
}
?>
這個問題似乎是重複的,但我已經利用了所有可能的解決方案。最終的解決方案是改變編碼格式。 – Amit 2011-12-30 09:30:50