我坚持这个,仍然得到“为foreach()提供的无效参数”错误。
这是我的代码:
@foreach ($requests as $request)
@include('sublayout.item_info',array('title' => $request['name'],'thumbnail' => 'img/goku_thumb.gif', 'general_status' => null,'link_url' => $request['studentID'], 'link_desc' => 'Aprovar'))
@endforeach
已经检查过,如果我使用@include注释{{print_r($ request}},我可以看到打印的数组......
使用以下代码进行测试:
@foreach ($requests as $request)
{{$request['name']}}<br>
{{print_r($request)}}
@endforeach
我得到了:
Victor
Array ( [name] => Victor [studentID] => 1 [pivot] => Array ( [subject_id] => 18 [user_id] => 1 ) ) 1
Wilton
Array ( [name] => Wilton [studentID] => 2 [pivot] => Array ( [subject_id] => 18 [user_id] => 4 ) ) 1
还尝试做类似的事情 $ variable = $ request ['name'] 并在include上使用它,但它失败了,同样的错误。
这会是刀片布局系统的限制吗?
谢谢!