繁体   English   中英

PHP-DI 突然在生产服务器中抛出“No entry or class found”错误

[英]PHP-DI Suddenly throws 'No entry or class found' error in production server

我有一个 PayPal 集成,为此,我有一个 Controller 和服务 class。

对于 controller:

<?php

namespace App\Billing\Infrastructure\PayPal;

use App\Billing\Infrastructure\PayPal\PaypalService;
use App\Billing\Infrastructure\Provider\Interfaces\ProviderContract;
use App\Billing\Infrastructure\Provider\Traits\DirectResponseBuilder;

class PaypalTransaction implements ProviderContract
{
    use DirectResponseBuilder;

    private $service;

    public function __construct(PaypalService $service)
    {
        $this->service = $service;
    }
}

对于服务 class:

<?php
    
namespace App\Billing\Infrastructure\PayPal;

use PDO;
use App\Billing\Infrastructure\Provider\Interfaces\ProviderServiceContract;
use App\Billing\Infrastructure\Provider\Traits\ConfigBuilder;
use App\Billing\Infrastructure\Provider\Traits\RequestErrorHandler;
use App\Billing\Infrastructure\DirectResponsesRepository;
use App\Billing\Infrastructure\EpgLogger;
use GuzzleHttp\Client;
use App\Infrastructure\Config;

class PaypalService implements ProviderServiceContract
{
    use RequestErrorHandler;
    use ConfigBuilder;

    private $env;
    private $client;
    private $pdo;
    private $logger;
    private $responsesRepository;

    public function __construct(Config $env, Client $client, PDO $pdo, EpgLogger $logger, DirectResponsesRepository $responsesRepository)
    {
        $this->env = $env;
        $this->client = $client;
        $this->pdo = $pdo;
        $this->logger = $logger;
        $this->responsesRepository = $responsesRepository;
    }
}

在我的本地开发中一切正常(顺便说一句,我正在使用 MAC,不确定此信息是否有用),但突然在生产/登台服务器中,它抛出错误提示:

Slim Application Error
The application could not run because of the following error:

Details
Type: DI\DependencyException
Message: Error while injecting dependencies into App\Billing\Infrastructure\PayPal\PaypalTransaction: No entry or class found for 'App\Billing\Infrastructure\PayPal\PaypalService'
File: /var/www/zweeler.com/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php

我还可以确认PaypalService class 的所有依赖项以及PaypalServicePaypalTransaction的所有特征和接口都是正确的。

截至目前,我对为什么会发生这种情况一无所知。

谁能帮忙?

您确定已包含/需要必要的文件吗? Class not found 是这种情况下的典型错误

payPal 有作曲家吗? 如果是,只需更新并确保您包含自动加载文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM