如何在 blade 模板中的 foreach 循环中使用 key

Lenix at 
foreach 在 Blade 中与普通的 PHP 的 foreach 一样工作 。您应该能够执行以下操作:@foreach ($nodes as $node) {{ $node->url }} @endforeach 如果您需要访问每个节点的数组键值 key:可以用以下方法 @foreach ($nodes as $key => $node) {{ $key }}: {{ $node->url }} @endforeach…The post 如何在 blade 模板中的 foreach 循环中使用 key first appeared on Lenix Blog.……