在 error_log 或页面上没有收到任何错误。错误日志肯定可以正常工作,就像我更改 require 'PHPMailer.php';
为require 'PHPFailer.php';
我得到的那样PHP Fatal error: require(): Failed
display_errors 设置为 true
error_reporting 设置为E_ALL & ~E_NOTICE
PHPMailer 6.1.7 - PHP 7.2
PHPMailer.php 和 Exception.php 都位于根目录中。当我刚刚发送到 /php/form_error.php 时,已注释掉重定向。
任何想法将不胜感激,谢谢。
contact_post.php
<?php
/*
THIS FILE USES PHPMAILER INSTEAD OF THE PHP MAIL() FUNCTION
*/
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer.php';
require 'Exception.php';
/*
* CONFIGURE EVERYTHING HERE
*/
// an email address that will be in the From field of the email.
$fromEmail = 'info@domain.co.uk';
$fromName = 'Info domain';
// an email address that will receive the email with the output of the form
$sendToEmail = 'info@domain.co.uk';
$sendToName = 'Info domain';
// subject of the email
$subject = 'New message from contact form';
// form field names and their translations.
// array variable name => Text to appear in the email
$fields = array('name' => 'Name', 'surname' => 'Surname', 'phone' => 'Phone', 'email' => 'Email', 'message' => 'Message');
// message that will be displayed when everything is OK :)
$okMessage = 'Contact form successfully submitted. Thank you, I will get back to you soon!';
// If something goes wrong, we will display this message.
$errorMessage = 'There was an error while submitting the form. Please try again later';
慕侠2389804