Laravel用foreach遍历的时候怎么排除一项?
比如,
一个用户有多篇文章,在一篇文章的详情页,显示了本篇文章的详情,在该文章详情下面,显示该用户的其他文章:
文章详情:
{{$article->title}}
{{$article->content}}
该用户其他文章:
@foreach ($articles as $article)
{{$article->title}}
@endforeach
问题:
在foreach遍历的时候,如何排除上面已经显示的文章?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
`
@foreach ($articles as $a)
@endforeach
`