这是给我这个,而不是改变头中的标头:PHP代码并没有改变
警告:不能更改头信息 - 已经 发送头(输出开始/家庭/内容/ 27/10711827/HTML/contact.php:2) /home/content/27/10711827/html/contact.php上线24
下面是代码。
<?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('[email protected]', 'Contact form', '$message', 'From: ' . $email);
header('Location: contact.php?sent');
exit();
}
}
不知道是什么问题,但你不需要'if(empty($ errors)=== true)'你可以做'if(empty($ errors))'与其他人一样。 – elclanrs 2013-04-05 01:21:47
contact.php第24行的内容是什么? – jcbwlkr 2013-04-05 01:22:23
好的,谢谢我会尝试在第24行工作的mabely – user2229396 2013-04-05 01:23:44