dpnfjx755573 2019-08-08 17:23
浏览 102
已采纳

网址生成Laravel [关闭]

I have url format /catalog/{countryName}/. Need fill in the url

$country = 'russia'
(oute('country',['countryName' => $country])); // http://localhost/catalog/russia

Result = http://localhost/catalog/russia.

But I need result = /catalog/russia formaty only path use standard method Laravel.

  • 写回答

1条回答 默认 最新

  • dqvj51875 2019-08-08 17:34
    关注

    Call your route like this:

    route('pages.countryCatalog', $country)
    

    In your route, try putting {country}.

    For example:

    Route::get('/catalog/{country?}', 'Your Controller Name here@Your Method')->name('pages.countryCatalog');
    

    Name the page what you want, just make sure they match so the route knows which route to go to!

    Note: you don't need the question mark in the { }, its saying its an optional parameter.

    Hope that helps!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像