在路由函数中读取 blade 变量

read blade variable within the route function

我在 Laravel 中有一个系统,当我在视图中构建带有链接的模板时,我需要像这样动态插入一个路由:

<ul class="breadcrumbs pull-left">
    <li><a href="{{route('home')}}">Home</a></li>
    <li><a href="{{route('$route.index')}}">{{$title}}</a></li>
    <li><span>{{$activeList}}</span></li>
</ul>

如何在路由函数中读取 blade 变量?

这不起作用:

{{route('$route.index')}}

错误:“路由 [$active.index] 未定义。(视图:C:\xampp\htdocs\systemass\resources\views\templates\srtdash\inc\pagearea.blade.php)(视图:C:\xampp\htdocs\systemass\resources\views\templates\srtdash\inc\pagearea.blade.php) (视图: C:\xampp\htdocs\systemass\resources\views\templates\srtdash\inc\pagearea.blade.php

只需使用变量内容即可

<ul class="breadcrumbs pull-left">
    <li><a href="{{route('home')}}">Home</a></li>
    <li><a href="{{route($active.'.index')}}">{{$title}}</a></li>
    <li><span>{{$activeList}}</span></li>
</ul>