它给了我这个而不是改变标题:
警告:无法修改标头信息 - 第 24 行 /home/content/27/10711827/html/contact.php 中的标头已由(输出开始于 /home/content/27/10711827/html/contact.php:2)发送
这是代码。
<?php
if (empty($_POST) === false){
$errors = array();
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
if (empty($name) === true || empty($email) === true || empty($message) === true){
$error[] = 'Name, email and message is required!';
} else{
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false){
$errors[] = 'That\'s not a valid email address';
}
if (ctype_alpha($name) === false){
$errors[] = 'Name must only cotain letters';
}
}
if(empty($errors) === true){
mail('houseblendrecords@gmail.com', 'Contact form', '$message', 'From: ' . $email);
header('Location: contact.php?sent');
exit();
}
}