【问题标题】:Laravel: Get route by specify nameLaravel:通过指定名称获取路线
【发布时间】:2016-07-11 15:07:42
【问题描述】:

我有这样的配置路线:

Route::get(
    'index/{type?}',
    [
        'as'   => 'AAA.index',
        'uses' => 'AAA@index',
    ]
);

Route::any(
    'create/{type}',
    [
        'as'   => 'AAA.create',
        'uses' => 'AAA@create',
    ]
);

如果我有一个字符串 AAA.index,我想得到 index/{type?}

如果我有一个字符串 AAA.create,我想获得 create/{type?}

有什么方法可以做到这一点?

【问题讨论】:

    标签: laravel get routes


    【解决方案1】:

    使用路由方式:

    route('AAA.index', $parameter);

    查看:https://laravel.com/docs/5.2/helpers#method-route

    【讨论】:

      猜你喜欢
      • 2015-02-12
      • 1970-01-01
      • 2018-04-30
      • 2023-03-10
      • 2015-02-15
      • 2018-04-04
      • 2015-07-14
      • 2016-05-08
      • 2015-09-14
      相关资源
      最近更新 更多