【问题标题】:Laravel how i get route with name in bladeLaravel我如何在刀片中获得名称的路线
【发布时间】:2021-07-04 08:57:21
【问题描述】:

我也有这样的路线。

Route::group(['prefix'=>LaravelLocalization::setLocale(),
    'as'=>'front.',
    'middleware'=>['localeSessionRedirect','localizationRedirect',]],function ()
{
    Route::get('/view/post/{id}', [ExtraController::class, 'SinglePost'])->name('post_view');
});

所以我想在刀片中调用这条路线。我如何获得 post_view 路线?

【问题讨论】:

    标签: php laravel routes


    【解决方案1】:
    <a href="{{route('post_view', [$post->id])}}">
    

    【讨论】:

      【解决方案2】:

      在你的观点中尝试这个:

      //example:
      <a href="{{route('post_view', $post->id)}}">
      

      【讨论】:

      • It get me Route [post_view] not defined。
      猜你喜欢
      • 1970-01-01
      • 2018-10-07
      • 1970-01-01
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 2020-05-19
      • 1970-01-01
      • 2020-08-04
      相关资源
      最近更新 更多