我知道在以前的Laravel版本中,您可以通过在route类中调用getCurrentRoute来获取名称,但是自从5.5发布以来,它仍然是如何实现这一目标的一个谜?
在以前的版本中,这就是我的操作方式。
Route::getCurrentRoute()->getPath();
最佳答案
您可以在路由类上调用currentRouteName
。
Route::currentRouteName();
不要忘记使用该类。
use Illuminate\Support\Facades\Route;
关于laravel - 获取Laravel 5.5中当前路线的名称,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48449008/