我在找出此错误来自哪里。任何人都可以阐明这个错误吗?
我已经清除了所有缓存文件并检查了错误文件是否错误。当我使用服务器的文件资源管理器时,该文件在那里。
此错误发生在登台服务器上,运行CPANEL PHP7.1。使用本地开发服务器时没有问题。
堆栈跟踪:
[2019-07-06 06:44:49] online.ERROR: Class mollie does not exist {"userId":"70a84900-9fa7-11e9-a421-57dbf5e49d9b","exception":"[object] (ReflectionException(code: -1): Class mollie does not exist at /home/serv/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:790)
[stacktrace]
#0 /home/serv/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(790): ReflectionClass->__construct('mollie')
#1 /home/serv/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(667): Illuminate\Container\Container->build('mollie')
#2 /home/serv/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(615): Illuminate\Container\Container->resolve('mollie', Array)
#3 /home/serv/app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(767): Illuminate\Container\Container->make('mollie', Array)
#4 /home/serv/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(1225): Illuminate\Foundation\Application->make('mollie')
#5 /home/serv/app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(175): Illuminate\Container\Container->offsetGet('mollie')
#6 /home/serv/app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(144): Illuminate\Support\Facades\Facade::resolveFacadeInstance('mollie')
#7 /home/serv/app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(231): Illuminate\Support\Facades\Facade::getFacadeRoot()
#8 /home/serv/app/app/Http/Controllers/PaymentController.php(62): Illuminate\Support\Facades\Facade::__callStatic('api', Array)
#9 [internal function]: App\Http\Controllers\PaymentController->preparePayment('starter')
Mollie类来自官方Mollie付款包https://github.com/mollie/laravel-mollie/blob/master/src/facades/mollie.php
我正在以文档描述的方式使用它:
$payment = Mollie::api()->payments()->create([
'amount' => [
'currency' => 'EUR',
'value' => $totalAmount, // You must send the correct number of decimals, thus we enforce the use of strings
],
'description' => $totalCoins,
'webhookUrl' => route('order.hook'),
'redirectUrl' => route('order.success'),
]);
这是该方法中Mollie的第一次
因此,在您的PaymentController
中,您引用了一个名为 mollie
的类,该类无法找到,从物理上讲,它在那里,但是您需要在控制器中导入它才能找到。
所以您可能会缺少其中的一些:
-
use Appmollie;
//作为导入/我不知道文件名称空间的示例 - 在您的
class mollie
中,您忘了添加namespace