我正在爲我的個人網站提供簡單的反饋提交表單。我收到以下錯誤PHP5 - 無法修改標題信息
警告:不能更改頭信息 - 已經 發送頭(輸出開始 /home/content/92/9339092/html/Pages/ArabicRootMachine/feedbackTEST.php:200)在線 在 /home/content/92/9339092/html/Pages/ArabicRootMachine/feedbackTEST.php 226 *
我試着加入ob_start()來緩衝任何輸出,但沒有工作。如果我將header()調用放在php腳本的開頭,表單工作併發送電子郵件,但它不會重定向到謝謝頁面。你們中的任何一位優秀的哺乳動物願意通過微風來查看是否有任何明顯的東西可能會引發這種錯誤?
注意:第200行是腳本的開始(php打開標記),第226行是標題調用。
<?php
include('./includes/title.inc.php');
require_once('./includes/recaptchalib.php');
$public_key = '****************************************';
$private_key = '****************************************';
$errors = array();
$missing = array();
// check if the form has been submitted
if (isset($_POST['send'])) {
// email processing script
$to = '[email protected]';
$subject = 'Feedback on Root Machine';
// list expected fields
$expected = array('name', 'email', 'comments');
// set required fields
$required = array('name', 'email', 'comments');
// create additional headers
$headers = "From: My Next Bit<[email protected]>\r\n";
$headers .= 'Content-Type: text/plain; charset=utf-8';
$response = recaptcha_check_answer($private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if (!$response->is_valid) {
$errors['recaptcha'] = true;
}
require('./includes/processmail.inc.php');
if ($mailSent) {
header('Location: http://www.mynextbit.com/Pages/ArabicRootMachine/thank_you.php');
exit();
}
}
?>
如果您需要查看任何**。inc.php文件,請讓我知道。我非常感謝任何幫助。
前200行是什麼?它是HTML的內容? – mbouzahir