路由命名

Route::get('user/{id?}', function ($id = 1) {
    return "用户ID: " . $id;
})->name('user.profile');
引用
<a href="{{ route('user.profile', ['id' => 100]) }}">
// 输出:http://blog.test/user/100
或者
<a href="{{ route('user.profile', [100]) }}">

//路由参数
Route::get('user/{id}', function ($id) {
    return "用户ID: " . $id;
});

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-06-08
  • 2021-12-03
  • 2021-06-13
  • 2021-09-15
猜你喜欢
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2021-12-03
相关资源
相似解决方案