【问题标题】:Laravel 2 routes return different pages,with and without parametersLaravel 2 路由返回不同的页面,带参数和不带参数
【发布时间】:2017-04-29 11:40:00
【问题描述】:

我需要两条路线:

1)localhost/static1/{param1}/{param2}

2)localhost/static1/static2/{param3}

Static1 在第一个和第二个 url 中是相同的。我的问题是,如果我导航到第二个 url,laravel 会将 static2 作为 param1 (param1 = static2)。如何定义这些路由以使它们返回不同的页面?

【问题讨论】:

    标签: laravel routes


    【解决方案1】:

    只需在你的路由文件中给更严格的路由更高的优先级,如下:

    Route::get('static1/static2/{param3}', function(){});
    
    Route::get ('static1/{param1}/{param2}', function(){});
    

    【讨论】:

      猜你喜欢
      • 2021-04-16
      • 1970-01-01
      • 1970-01-01
      • 2017-07-10
      • 2017-04-04
      • 2021-09-21
      • 1970-01-01
      • 2015-08-13
      • 1970-01-01
      相关资源
      最近更新 更多