容器中的反射异常.php第 719 行:类绑定不存在



>最近我正在使用 laravel 5.4(我之前使用过 laravel 5.2(进行一个项目。我的 API 中有简单的路由.php

Route::get('/test', function () {
return "test";
});

当我尝试使用 url/api/test邮递员访问此 url 时,我收到以下错误-

ReflectionException in Container.php line 719:
Class bindings does not exist

laravel 5.2 中使用 api 时,我没有遇到这种错误。现在我被困在这里。希望有人有解决方案,谢谢。

晚了,但就我而言,注意 RouteServiceProvider 中的函数 mapWebRoutes .php是我找到解决方案的地方。选项"网络"是我需要的。

protected function mapWebRoutes(Router $router)
{
    $router->group([
        'namespace' => $this->namespace, 'middleware' => 'web',
    ], function ($router) {
        require app_path('Http/routes.php');
    });
}

最新更新