我正在为我的个人网站制作一个简单的反馈提交表单。我收到以下错误
警告:无法修改标头信息 - 标头已由 /home/content/92/9339092/html/Pages/ 中的(输出开始于 /home/content/92/9339092/html/Pages/ArabicRootMachine/feedbackTEST.php:200)发送第 226 行的 ArabicRootMachine/feedbackTEST.php*
我尝试添加 ob_start() 来缓冲任何输出,但这不起作用。如果我将 header() 调用放在 php 脚本的开头,表单会起作用并发送电子邮件,但它不会重定向到感谢页面。你们中的任何一个优秀的哺乳动物都愿意轻而易举地看看是否有任何明显的东西可能会引发这个错误?
注意:第 200 行是脚本的开头(php open 标记),第 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 = 'blahblah@gmail.com';
$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<feedback@mynextbit.com>\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 文件,请告诉我。我非常感谢任何帮助。