Php 为什么我的表格不再显示?
我在一个PHP项目中创建了一个联系人表单,我一直在尝试让邮件发送,在这个过程中,我一直在修改一些代码,比如删除我的联系人表单。现在我重新添加了表单,但它不会显示在浏览器上: 这是名为contact.php的实际文件:Php 为什么我的表格不再显示?,php,Php,我在一个PHP项目中创建了一个联系人表单,我一直在尝试让邮件发送,在这个过程中,我一直在修改一些代码,比如删除我的联系人表单。现在我重新添加了表单,但它不会显示在浏览器上: 这是名为contact.php的实际文件: <?php define("TITLE", "Contact Us | MicroUrb"); include('includes/header.php'); /** * PHPMailer Autoloader */ require '../ve
<?php
define("TITLE", "Contact Us | MicroUrb");
include('includes/header.php');
/**
* PHPMailer Autoloader
*/
require '../vendor/phpmailer/phpmailer/PHPMailerAutoload.php';
/**
* Configure PHPMailer with your SMTP server settings
*/
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = 'myemail@example.com';
$mail->Password = 'secret';
$mail->SMTPSecure = 'tls';
/**
* Enable SMTP debug messages
*/
$mail->SMTPDebug = 2;
/**
* Send an email
*/
$mail->setFrom('sender@gmail.com');
$mail->addAddress('recipient@gmail.com');
$mail->Subject = 'An email sent from PHP';
$mail->Body = 'This is a test message';
if ($mail->send()) {
echo 'Message sent!';
} else {
echo 'Mailer error: ' . $mail->ErrorInfo;
}
?>
<div id="contact">
<hr>
<h1 class="contact">Get in touch with us!</h1>
<form method="post" action="" id="contact-form">
<label for="name">Your name</label>
<input type="text" id="name" name="name">
<label for="email">Your email</label>
<input type="email" id="email" name="email">
<label for="message">and your message</label>
<textarea id="message" name="message"></textarea>
<input type="checkbox" id="subscribe" name="name" value="Subscribe">
<label for="">Subscribe to newsletter</label>
<input type="submit" class="button next" name="contact_submit" value="Send Message">
</form>
<hr>
</div>
<?php include('includes/footer.php'); ?>
与我们联系!
你的名字
你的电子邮件
你的留言呢
订阅时事通讯
请注意:您不需要。/vendor/phpmailer/phpmailer/phpmailerautoad.php
,只需要。/vendor/autoload.php
就可以了。您是否可能有一个显示:无代码>在css上定位表单?有东西正在破坏,导致整个表单无法显示。您是否在主页中包含contact.php?或者您向我们展示的是contact.php吗?是否启用了错误报告?错误日志中有任何内容吗?我在index.php上有错误报告,但它没有显示任何内容。我向您展示的是contact.php页面。我没有展示:没有;以表单为目标,它在我开始处理代码之前就已经显示出来了。