当我使用此命名空间中的另一个类时找不到类

时间:2017-01-22 18:42:06

标签: php

我有index.php文件和内容(剪辑):

define('SMS_DIR', dirname(__FILE__) . '/sms_ru_master/'); 
require_once(ENGINE_DIR . 'main/registry.php');
require_once(SMS_DIR . 'Api.php');
$registry = new Registry();
$sms = new \Zelenin\SmsRu\Api(new \Zelenin\SmsRu\Auth\ApiIdAuth($apiId));
$registry->sms = $sms;

我使用Api.php来使用API​​一些代码:

<?php

namespace Zelenin\SmsRu;

use Zelenin\SmsRu\Auth\AuthInterface;
use Zelenin\SmsRu\Client\Client;
use Zelenin\SmsRu\Client\ClientInterface;
use Zelenin\SmsRu\Entity\AbstractSms;
use Zelenin\SmsRu\Entity\Sms;
use Zelenin\SmsRu\Entity\SmsPool;
use Zelenin\SmsRu\Entity\StoplistPhone;
use Zelenin\SmsRu\Exception\Exception;
use Zelenin\SmsRu\Response\AuthCheckResponse;
use Zelenin\SmsRu\Response\MyBalanceResponse;
use Zelenin\SmsRu\Response\MyLimitResponse;
use Zelenin\SmsRu\Response\MySendersResponse;
use Zelenin\SmsRu\Response\SmsCostResponse;
use Zelenin\SmsRu\Response\SmsResponse;
use Zelenin\SmsRu\Response\SmsStatusResponse;
use Zelenin\SmsRu\Response\StoplistAddResponse;
use Zelenin\SmsRu\Response\StoplistDelResponse;
use Zelenin\SmsRu\Response\StoplistGetResponse;

class Api
{
    /**
     * @var AuthInterface
     */
    private $auth;

    /**
     * @var ClientInterface
     */
    private $client;

    /**
     * @param AuthInterface $auth
     */
    public function __construct(AuthInterface $auth)
    {
        $this->auth = $auth;
        $this->auth->setContext($this);
    }

但是当我使用

$sms = new \Zelenin\SmsRu\Api(new \Zelenin\SmsRu\Auth\ApiIdAuth($apiId));

我收到错误:致命错误:Class&#39; Zelenin \ SmsRu \ Auth \ ApiIdAuth&#39;在第43行的C:\ OpenServer \ domains \ sowords.com \ index.php中找不到

我该怎么办?

在github https://github.com/zelenin/sms_ru

上课

0 个答案:

没有答案