我刚刚更新了网站的联系表格,但我不断收到500错误代码。我的PHP文件中是否有引发此错误的错误?
我正在为我母亲的玫琳凯部门的着陆页工作,并且刚刚更新了联系表。但是,我已确保重定向正常工作,并注释掉了额外的$ msg变量,该变量显示为“文本的第一行...”
<?php
if(isset($_POST['contact_form_submit'])){
//if the page does have post data, process it
//gather post data
$contactName = striptags(trim(htmlspecialchars($_POST['contact_name'])));
$contactEmail = striptags(trim(htmlspecialchars($_POST['contact_email'])));
$contactMessage = striptags(trim(htmlspecialchars($_POST['contact_message'])));
//Create the email message
$msg = "You have received a message from: ".$contactName.", ".$contactEmail.", Message = ".$contactMessage;
//the message
//$msg = "First line of text\nSecond line of text";
//use wordwrap() if lines are longer than 70 characters
$msg = wordwrap($msg,70);
//send email
//omitting my email address
mail("example@gmail.com","New Contact Form Submission",$msg);
echo 'Email has been sent.';
//if message successful, redirect user to thank you page
header('Location: https://adenaharper.com/thank-you');
} else {
//kick the user from the page
echo 'Peace out!';
}
?>
我希望表单提交到我的电子邮件地址,但是给了我500错误代码。