[英]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 的所有依賴項以及PaypalService
和PaypalTransaction
的所有特征和接口都是正確的。
截至目前,我對為什么會發生這種情況一無所知。
誰能幫忙?
您確定已包含/需要必要的文件嗎? Class not found 是這種情況下的典型錯誤
payPal 有作曲家嗎? 如果是,只需更新並確保您包含自動加載文件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.