PHPMailer似乎安装不正确:未捕获错误:Class'PHPMailerPHPMailerPHPMailer [英] PHPMailer seems to not install correctly: Uncaught Error: Class 'PHPMailerPHPMailerPHPMailer

查看:9
本文介绍了PHPMailer似乎安装不正确:未捕获错误:Class'PHPMailerPHPMailerPHPMailer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行代码时收到上面的错误。按照PHPMailer Github页面上的说明,我在Composer.json中添加了"phpmaeller/phpmaeller":"^6.0",但PHPMailer似乎没有加载。

我尝试使用$mail=new PHPMailerPHPMailerPHPMailer(True)代替$Mail=new PHPMailer(True)。我去了Composer IRC频道,看看我的问题是不是与Composer有关。我还尝试在Required‘Vendor/autoload.php’;语句中使用完整路径。

// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerException;

//Load Composer's autoloader
require 'vendor/autoload.php';


//other code...

//Create a new PHPMailer instance
    $mail = new PHPMailer(true);

我希望PHPMailer运行。我哪里出错了?

推荐答案

只需从GIT回购链接下载phpMailer类

https://github.com/PHPMailer/PHPMailer
并解压/复制PHPMailer.php、Extension.php和SMTP.php三个文件。php文件将它们放在一个文件夹名称中:(PHPMailer),如下图所示:- https://i.stack.imgur.com/T6DXW.png

只需将这些代码行添加到文件的顶部

//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerSMTP;
use PHPMailerPHPMailerException;

//Load Composer's autoloader
//  require 'vendor/autoload.php';
require('PHPMailer/Exception.php');
require('PHPMailer/SMTP.php');
require('PHPMailer/PHPMailer.php');

这篇关于PHPMailer似乎安装不正确:未捕获错误:Class'PHPMailerPHPMailerPHPMailer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆