遇到PHPMailer未定义类型错误(尝试使用Composer也无效)
P粉921165181
P粉921165181 2023-11-12 17:35:06
0
1
351

我不知道为什么会收到此“PHPMailer 未定义类型”错误。首先,我尝试直接下载zip并从github复制代码,同样的问题出现,然后我下载了我不想下载的composer,但下载后仍然显示相同的错误。

请问我可以对此有什么想法吗? (以下截图)

作曲家 img 错误

没有作曲家img时出现同样的错误

目录图片

这是代码

session_start();

// Import PHPMailer classes into the global namespace 
use PHPMailerPHPMailerPHPMailer; 
use PHPMailerPHPMailerException; 
 
require 'PHPMailer/src/Exception.php'; 
require 'PHPMailer/src/PHPMailer.php'; 
require 'PHPMailer/src/SMTP.php'; 
 
$mail = new PHPMailer(true);   // error coming here
 
$mail->isSMTP();                      // Set mailer to use SMTP 
$mail->Host = 'smtp.gmail.com';       // Specify main and backup SMTP servers 
$mail->SMTPAuth = true;               // Enable SMTP authentication 
$mail->Username = 'user@gmail.com';   // SMTP username 
$mail->Password = 'gmail_password';   // SMTP password 
$mail->SMTPSecure = 'tls';            // Enable TLS encryption, `ssl` also accepted 
$mail->Port = 587;                    // TCP port to connect to 
 
// Sender info

谢谢

P粉921165181
P粉921165181

最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!