Laravel路由系统 [英] Laravel routing system

查看:67
本文介绍了Laravel路由系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用laravel 4,并且我的路线有问题,

I am working with laravel 4 and i have a problem with my routes,

例如:

//Route to display a campaign
Route::get('campaigns/{name}', 'CampaignController@show');

//Route to create a campaign
Route::get('campaigns/add', 'CampaignController@create');

这里的问题是:路由系统认为campaigns/add中的 add 广告系列名称,因此将我带到campaigns/{name}

The problem here is : the routing system thinks that the add in campaigns/add is a campaign name so it takes me to campaigns/{name}

我该如何解决?

任何帮助将不胜感激!

推荐答案

Laravel从上到下匹配路由.因此,您所需要做的就是在通配符路径上方添加广告系列/添加".

Laravel matches routes from the top down. So all you need to do is put 'campaigns/add' above the wildcard route.

这篇关于Laravel路由系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆