Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Laravel href 路由名称中插入数据库值?这可能吗?
<a href="{{route('user.{{$adminbank->link}}')}}">{{$adminbank->bank_name}}</a>
假设您的路线名称类似于user.show并且$adminbank->link是“显示”:
user.show
$adminbank->link
<a href="{{route('user.' . $adminbank->link)}}">{{$adminbank->bank_name}}</a>
(不要{{ }}在里面使用{{ }})
{{ }}
尝试这个:
<a href="{{route("user.{$adminbank->link}")}}">{{$adminbank->bank_name}}</a>