本文介绍了Laravel route.php越来越大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着您不断向Routes.php添加越来越多的路由,它会变得越来越大.您如何组织它们?

As you continually add more and more routes to Routes.php it gets bigger and bigger. How do you organize them?

推荐答案

我通常使用分组路由(因为与控制器相关的控制器往往具有相同类型的过滤器)来组织它们,或者如果您希望/可以拥有较小的路由文件,则可能要注册您的控制器,并对控制器本身内部的URL参数进行额外的验证检查.

I usually use Group routes (because controllers tend to have the same type of filtering needed if they are related) to organize them or if you wish to/can have a smaller routes file you might want to register your controllers and do the extra validation checks of the URL's parameters inside the controller itself.

这篇关于Laravel route.php越来越大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 12:50