【发布时间】:2017-04-29 11:40:00
【问题描述】:
我需要两条路线:
1)localhost/static1/{param1}/{param2}
和
2)localhost/static1/static2/{param3}
Static1 在第一个和第二个 url 中是相同的。我的问题是,如果我导航到第二个 url,laravel 会将 static2 作为 param1 (param1 = static2)。如何定义这些路由以使它们返回不同的页面?
【问题讨论】:
我需要两条路线:
1)localhost/static1/{param1}/{param2}
和
2)localhost/static1/static2/{param3}
Static1 在第一个和第二个 url 中是相同的。我的问题是,如果我导航到第二个 url,laravel 会将 static2 作为 param1 (param1 = static2)。如何定义这些路由以使它们返回不同的页面?
【问题讨论】:
只需在你的路由文件中给更严格的路由更高的优先级,如下:
Route::get('static1/static2/{param3}', function(){});
Route::get ('static1/{param1}/{param2}', function(){});
【讨论】: