laravel - 为什么我总是在新创建时清除路由和缓存路由?
问题描述
我正在使用 Laravel 8,但我遇到了路由问题。当我创建路由时,在运行以下命令后它不会出现在路由列表中
php artisan route:clear
php artisan route:cache
我得到了所有的路线。我该如何解决。为什么我为新路线运行这些命令?
解决方案
从文档:
优化路由加载
如果您正在构建具有许多路由的大型应用程序,则应确保
route:cache
在部署过程中运行 Artisan 命令:
php artisan route:cache
此命令将所有路由注册减少到缓存文件中的单个方法调用中,从而在注册数百条路由时提高路由注册的性能。
您应该只php artisan route:cache
在部署期间运行,而在本地开发时,您不应该缓存您的路线,否则您创建的新路线在您运行php artisan route:clear
或php artisan route:cache
再次运行之前不会被注册。
php artisan route:cache
// clears the route cache and then re caches the routes
php artisan route:clear
// clears the route cache
推荐阅读
- php - PHP毕达哥拉斯检查它是否是正确的答案
- firebase - React-native firebase Signinwithemal 和 createuserwithemailandpassword
- react-native - alpha,beta,生产的不同反应本机应用程序图标?
- python - 为什么我的退出状态为 1?
- python - 用于非缺失值的 pandas groupby
- python-3.x - 为什么我在这个打印语句上得到无效的语法?
- php - Exec() 为FFMPEG创建两个不同的进程
- angularjs - 将 AngularJS 迁移到 Angular 5
- vim - vim w0ro/ale tslint 不起作用
- angular - Angular如何默认设置单选按钮,反应式表单