【问题标题】:Get the name of the current route in Laravel 5.5在 Laravel 5.5 中获取当前路由的名称
【发布时间】:2018-07-05 01:32:29
【问题描述】:

我知道在以前的 Laravel 版本中,您可以通过在路由类中调用 getCurrentRoute 来获取名称,但自从 5.5 发布以来,我如何做到这一点仍然是个谜?

在以前的版本中,我就是这样做的。

Route::getCurrentRoute()->getPath();

【问题讨论】:

    标签: laravel routes


    【解决方案1】:

    你可以在路由类上调用currentRouteName

    Route::currentRouteName();
    

    别忘了使用类。

    use Illuminate\Support\Facades\Route;
    

    【讨论】:

    • 谢谢!我知道仍然有一种简单的方法。
    猜你喜欢
    • 1970-01-01
    • 2018-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-28
    • 1970-01-01
    • 2016-05-09
    相关资源
    最近更新 更多