laravel-5 - Laravel如何禁用/删除路由缓存
问题描述
我正忙于将 Laravel 5.4 升级到 5.8 并收到错误无法为序列化准备路由 xxx。使用 s 闭包。
我有很多闭包,web.php
不打算重构它。
是否有可能以及如何删除/禁用路由缓存?
错误:
LogicException : Unable to prepare route [login] for serialization. Uses Closure.
at C:\App\lv-5-8\vendor\laravel\framework\src\Illuminate\Routing\Route.php:917
913| */
914| public function prepareForSerialization()
915| {
916| if ($this->action['uses'] instanceof Closure) {
> 917| throw new LogicException("Unable to prepare route [{$this->uri}] for seriali
zation. Uses Closure.");
918| }
919|
920| $this->compileRoute();
921|
Exception trace:
1 Illuminate\Routing\Route::prepareForSerialization()
C:\App\lv-5-8\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteCacheCommand.
php:62
2 Illuminate\Foundation\Console\RouteCacheCommand::handle()
C:\App\lv-5-8\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32
Please use the argument -v to see more details.
解决方案
在我composer.json
那里有php artisan optimize
在 Laravel 5.6 中被弃用的。所以我删除了它并且它有效。
推荐阅读
- unity3d - 脚本中制作的预制克隆未更新
- javascript - VS Code Intellisense 和 Node JS 的奇怪行为
- google-cloud-platform - GSuite/云平台 - 修复或重置权限
- python - Softmax 不会导致 Python 实现中的概率分布
- android - 为 NDK 设置 Crashlytics 后,我看不到行号或符号
- java - 在 ActionPerformed 中调用非局部变量
- javascript - jsp页面无法显示数据库信息
- java - 使用处理连接到arduino的串行端口的问题
- sql - 连接字段并消除所有空格
- ffmpeg - FFMPEG 将多个音频输入文件映射到 1 个单个图像文件,以便创建多个视频输出文件