laravel 包中路由声明的顺序

order of route declarations in laravel package(laravel 包中路由声明的顺序)
本文介绍了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 包中路由声明的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)