order of route declarations in laravel package(laravel 包中路由声明的顺序)
问题描述
我制作了一个包含路由的 laravel 包,它是一个特殊的路由,可以捕获大量可能的 url.我不希望我的路由优先于主应用程序中声明的其他包或路由.如何确保我的路线是最后声明的路线?
I have made a laravel package which contains a route, it is a special route that catches a large number of possible urls. I don't want my route to take precedence over other packages or routes declared in the main application. How can I ensure that my route is the last route declared?
推荐答案
路由按照它们在 routes.php 中列出的顺序进行评估.只需确保这条路线是数组中的最后一条即可.
Routes are evaluated in the order that they are listed in routes.php. Simply making sure this route is the last one in the array should do it.
更新
我相信你可以在 App::before 过滤器中注册路由,它会在所有用户路由之后注册它.
I believe you could just register the route in the App::before filter, which would register it after all user routes.
这篇关于laravel 包中路由声明的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:laravel 包中路由声明的顺序


- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- Laravel 仓库 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01