【问题标题】:Pipedrive Class not found?找不到 Pipedrive 类?
【发布时间】:2016-11-06 14:37:33
【问题描述】:

我遇到了一个奇怪的错误。我得到了一段相当简单的代码,但它不断给我错误,找不到类。

我得到的错误是

致命错误:在第 4 行的 /home/preston/public_html/fullslate-pipedrive/index.php 中找不到类“pipedriveintegrationConfig”

这里是 index.php

require_once 'config.php';
require_once pipedriveintegrationConfig::PHP_LIB;
require_once 'fullslate.php';
require_once 'pipedrive.php';
require_once 'fullslate-pipedrive.php';

pipedriveintegrationConfig::init();

if ($_SERVER['argc'] > 1) {
    $action = $_SERVER['argv'][1];
} else
if (isset($_GET['action'])) {
    $action = $_GET['action'];
}


if ($action) {
    switch($action) {
        case 'sync-clients':
            $client = new pipedriveintegrationFullslatePipedrive(pipedriveintegrationFullslateConfig::toArray(), pipedriveintegrationPipedriveConfig::toArray());
            $client->syncClients();
            break;
        default:
            throw new CustomException('Unknown command line action: ', $action);
            break;
    }

} else {

if (file_exists(__DIR__ . '/test.php')) {
    require_once __DIR__ . '/test.php';
}

}

config.php 的代码是

namespace pipedriveintegration;

class PipedriveConfig{
    const URL = 'https://api.pipedrive.com/v1';
    const API_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXX';

    const STAGE_ID_NEW_PROSPECT = 1;
    const STAGE_ID_CONSULTATION_SCHEDULED = 3;

    public static
    function toArray() {
        return array('url' => self::URL, 'api_token' => self::API_TOKEN, 'stage_id_new_prospect' => self::STAGE_ID_NEW_PROSPECT, 'stage_id_consultation_scheduled' => self::STAGE_ID_CONSULTATION_SCHEDULED,);
    }

}

class FullslateConfig{
    const URL = 'https://slcguitar.fullslate.com/api';
    const API_TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXx';
    public static
    function toArray() {
        return array('url' => self::URL, 'api_token' => self::API_TOKEN,);
    }

}

///////////////////////////////////////////////////////////////////////////////////////////////////
class Config{

    const PHP_LIB = 'PHPLib.php';

    const USE_TIMESTAMP = false;
    //'2014-12-15';
    public static
    function init() {
        APP::init(array('mode' => 'development','log' => array('level' => Log::LEVEL_ALL, 'append' => true, 'limit' => 10,), 'curl' => array('log' => false, 'retry' => 3,),'temp' => array('path' => __DIR__, 'active' => true,),));
    }
}

class PDEBUG{
    const USE_FIDDLER = false;
}

不确定我做错了吗?

【问题讨论】:

    标签: php classnotfoundexception classnotfound


    【解决方案1】:

    您需要将要求更改为:

    require_once \pipedriveintegration\Config::PHP_LIB;
    

    您的命名空间是 pipedriveintegration 而不是 pipedriveintegrationConfig。常量也在类 Config 中。

    我不知道您使用的是哪个 PHP 版本,但我在 5.6 中对此进行了测试,并且可以正常工作。

    【讨论】:

      【解决方案2】:

      请删除 API 令牌,并在应用程序中重新生成它们,通过发布 API 令牌,您将向所有人授予您帐户的访问权限。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-10-15
        • 2015-05-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多