【问题标题】:Mautic - Fatal error: Class 'Mautic\Auth\ApiAuth' not foundMautic - 致命错误:找不到类“Mautic\Auth\ApiAuth”
【发布时间】:2018-02-20 01:46:20
【问题描述】:

我在安装Mautic php api-library 时遇到问题,如the docs 所述。我下载了上面提到的压缩包。

从 Github 下载包。提取然后在您的项目中包含以下代码:

我下载了包含很多php文件的lib文件夹并将其添加到我的项目中,然后他们创建了一个简单的php文件。

<?php
require_once __DIR__ . '/lib/Mautic/MauticApi.php'; // yes, the path is correct
use Mautic\Auth\ApiAuth;
session_start();
$settings = array(
    'userName'   => '...',
    'password'   => '...'
);

// Initiate the auth object specifying to use BasicAuth
$initAuth = new ApiAuth();
$auth = $initAuth->newAuth($settings, 'BasicAuth');

找到了 MauticApi.php 文件,但执行时出现错误。

致命错误:在第 11 行的 C:\xampp\htdocs\test\test.php 中找不到类“Mautic\Auth\ApiAuth”

我认为 lib 文件夹内的所有文件都必须递归包含。但文档告诉只包含 MauticApi.php 文件。那是对的吗?我该怎么办?

服务器信息:

PHP Version 5.6.33
cURL support enabled 
cURL Information 7.56.0 
Server API Apache 2.0 Handler 

【问题讨论】:

    标签: php mautic


    【解决方案1】:

    我建议使用 composer 来安装库并只包含自动加载文件。手动添加库将强制您在脚本中包含所有文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-10
      • 2017-03-05
      • 1970-01-01
      • 2016-05-26
      • 2018-03-09
      • 1970-01-01
      • 1970-01-01
      • 2021-04-24
      相关资源
      最近更新 更多