首页 > 解决方案 > Laravel 流明错误:在全栈 laravel 框架中实现流明时出错

问题描述

我在全栈 Laravel 框架中添加了 Laravel 流明,但我遇到了如下 API 路由问题。请帮我解决以下问题。

我添加了 bootstrap/api.php 以在 laravel 框架中使用 lumen。我在 Laravel 框架中配置如下流明。

引导启动/api.php

$app->register(App\Providers\AppServiceProvider::class);

App\Providers\AppServiceProvider

$this->app->singleton('Illuminate\Contracts\Routing\ResponseFactory', function ($app) {
        return new ResponseFactory(
            $app['Illuminate\Contracts\View\Factory'],
            $app['Illuminate\Routing\Redirector']);
});

在中添加上述代码后AppServiceProvider,我收到此错误:

目标 [Illuminate\Routing\RouteCollectionInterface] 在构建 [Illuminate\Routing\Redirector, Illuminate\Routing\UrlGenerator] 时不可实例化

先感谢您。

标签: phplaravellumen

解决方案


推荐阅读