Laravel 无法为序列化准备路由 [api/user]。使用闭包
Laravel Unable to prepare route [api/user] for serialization. Uses Closure
当我评论所有路线时出现此错误。
请告诉我,关闭路线是什么?以及为什么显示此错误
闭包是 anonymous function which is used to define routes without an action:
Route::get('/test', function () {
return 'hello world';
});
上面的示例 returns hello world
当您在浏览器中调用路由 /test
时。
您不能缓存引用闭包的路由。
默认 Laravel 应用程序中有两个使用闭包的路由:在文件 routes/api.php
and routes/web.php
中。删除它们或将它们移动到控制器,您就可以缓存您的路由。
Laravel 框架存储库中的 an issue 正在讨论此行为。
当我评论所有路线时出现此错误。 请告诉我,关闭路线是什么?以及为什么显示此错误
闭包是 anonymous function which is used to define routes without an action:
Route::get('/test', function () {
return 'hello world';
});
上面的示例 returns hello world
当您在浏览器中调用路由 /test
时。
您不能缓存引用闭包的路由。
默认 Laravel 应用程序中有两个使用闭包的路由:在文件 routes/api.php
and routes/web.php
中。删除它们或将它们移动到控制器,您就可以缓存您的路由。
Laravel 框架存储库中的 an issue 正在讨论此行为。