在Laravel框架上获取数组时遇到一些问题。 当我选择var_dump(视图中为var_dummp)时,我会有这样的响应
array(6) { [0]=> array(1) { ["url"]=> string(156) "https://ae01.alicdn.com/kf/HTB1PsZyqbSYBuNjSspiq6xNzpXaj/Popular-2-pcs-Ponytail-Creator-Plastic-Loop-Styling-Tools-Black-Topsy-Pony-topsy-Tail-Clip-Hair.jpg" } [1]=> array(1) { ["url"]=> string(156) "https://ae01.alicdn.com/kf/HTB1rhIRdIj_B1NjSZFHq6yDWpXaG/Popular-2-pcs-Ponytail-Creator-Plastic-Loop-Styling-Tools-Black-Topsy-Pony-topsy-Tail-Clip-Hair.jpg" } [2]=> array(1) { ["url"]=> string(156) "https://ae01.alicdn.com/kf/HTB1h0DQnbSYBuNjSspiq6xNzpXay/Popular-2-pcs-Ponytail-Creator-Plastic-Loop-Styling-Tools-Black-Topsy-Pony-topsy-Tail-Clip-Hair.jpg" } [3]=> array(1) { ["url"]=> string(156) "https://ae01.alicdn.com/kf/HTB1BGEOnf5TBuNjSspmq6yDRVXao/Popular-2-pcs-Ponytail-Creator-Plastic-Loop-Styling-Tools-Black-Topsy-Pony-topsy-Tail-Clip-Hair.jpg" } [4]=> array(1) { ["url"]=> string(156) "https://ae01.alicdn.com/kf/HTB1RzEeXuUXBuNjt_XBq6xeDXXaP/Popular-2-pcs-Ponytail-Creator-Plastic-Loop-Styling-Tools-Black-Topsy-Pony-topsy-Tail-Clip-Hair.jpg" } [5]=> array(1) { ["url"]=> string(156) "https://ae01.alicdn.com/kf/HTB1wgyLe8yWBuNkSmFPq6xguVXa1/Popular-2-pcs-Ponytail-Creator-Plastic-Loop-Styling-Tools-Black-Topsy-Pony-topsy-Tail-Clip-Hair.jpg" } }
当我要遍历该数组时,我正在这样写。
@foreach ($images as image)
<li><img src="{{ $image['url'] }}" class="img-fluid w-100" alt="Image Title"></li>
@endforeach
并给出错误
syntax error, unexpected ')', expecting '[' (View: C:\Users\Rade\Desktop\ecomet-html\resources\views\product_info.blade.php)
为什么?