php - 在 Laravel 控制器中找不到 PHP 类
问题描述
我在 Laravel 控制器中遇到问题,我不确定从哪里开始进行故障排除。基本上 2 个单独的方法正在调用同一个外部类;该process
方法有效,但是在调用时process3d
我遇到了错误class 'App\Services\PaymentGateway\Gateway\RequestGatewayEntryPointList' not found.
调试控制器.php
namespace App\Http\Controllers;
use App\Services\PaymentGateway\Gateway\RequestGatewayEntryPointList;
...
public function process(Request $request) {
...
$rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList;
...
}
public function process3d(Request $request) {
...
$rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList;
...
}
支付系统.php
namespace App\Services\PaymentGateway\Gateway;
...
class RequestGatewayEntryPointList {
...
}
我省略了不相关的代码以保持问题简短,但如果有帮助,我当然很乐意提供更多详细信息。
这是怎么回事?
解决方案
发布到 stackoverflow 后 5 分钟找到它......哎呀。
process3d 缺少 require_once DIR .'/../../Services/PaymentGateway/Gateway/PaymentSystem.php';
添加这个解决了这个问题。
推荐阅读
- excel - Excel中的多变量数据表导致它挂起
- python - 如何在 Python 中将参数从一个函数传递到下一个函数?
- typescript - 在打字稿界面中必须设置两个属性之一
- cassandra - 面向列的数据库如何将数据存储在磁盘中?
- python-3.x - 更改几个 numpy 数组的掩码
- paypal - 使网站用户相互汇款的最佳方式是什么?
- python-3.x - 并且,== 运算符在同一个 python if 语句中
- junit - 如何在私有方法中测试局部变量?我
- google-cloud-ml - Google Cloud 上内置图像对象检测中的对象标签“从 0 到 num_classes-1”或从“1 到 num_classes”?
- java - Hibernate 从 MySQL 检索 LocalDate 减去一天