doulianxing4015 2018-07-24 19:21
浏览 39

找不到PHPMailer类

I have PHPMailer working in my code in my local enviroment but when I move it to the server I get the following error

Class 'PHPMailer\PHPMailer\PHPMailer' not found

Heres the bit of code that im using:

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

class Email extends EV_DB {
  function __construct() {
    parent::__construct();
    $this->email_common  = [
      'baseurl' => $_SERVER['HTTP_HOST']
    ];
    $this->stache = new Mustache_Engine(array(
        'loader' => new Mustache_Loader_FilesystemLoader( __DIR__ .'/../../mustache'),
    'partials_loader' => new Mustache_Loader_FilesystemLoader( __DIR__  .'/../../mustache/partial')
));
    $mail = new PHPMailer(true);
...

I installed PHPMailer with composer, and have my codeigniter setup to autoload in a config file, which is why theres not require for the autoload.php. I'm sure this is working correctly since mustache loads just fine, and if I try to manually include the autload file it gives me the error:

Cannot declare class ComposerAutoloaderInitb315d7432979fc7d6789bb454c858180, because the name is already in use.

The difference between my local and live enviroments is that I have the application folder separate from where the index.php lives. So in the index.php I have set:

$application_folder = 'C:\inetpub\my_application\application';

while the index file lives in

C:\inetpub\wwwroot\MyApplication\index.php

Is this location change changing the what the namespace should be set as? I don't really know enough to troubleshoot past this point.

  • 写回答

1条回答 默认 最新

  • dtwye28880 2018-07-25 12:52
    关注

    In the end reinstalling PHPMailer through composer did the trick. I guess something went wrong during installation. Whoops.

    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站