3 回答
![?](http://img1.sycdn.imooc.com/545847f50001126402200220-100-100.jpg)
TA贡献1812条经验 获得超5个赞
你可以试试这个吗..希望它能工作
@for ($i = $delegateGroup; $i < count($delegateGroup); $i++)
<td> {{ $delegateGroup[i][0] </td>
@endfor
![?](http://img1.sycdn.imooc.com/545865b000016a9202200220-100-100.jpg)
TA贡献1909条经验 获得超7个赞
找到之前最长的数组
$rowCount = 0;
array_walk($delegateType, function ($items) use (&$rowCount) {
$count = count($items);
if ($count > $rowCount)
$rowCount = $count;
});
在$ delegateType之后的回显索引
和每个数组的第一个值echo
<table>
<thead>
<tr>
@foreach(array_keys($delegateType) as $group)
<th>
@if(isset($group))
$group
@endif
</th>
@endforeach
</tr>
</thead>
<tbody>
@for ($i = 0; $i < $rowCount; $i++)
<tr>
@foreach($delegateType as $group => $values)
<td>
@if(isset($values[$i]))
{{$values[$i]}}
@endif
</td>
@endforeach
</tr>
@endfor
</tbody>
- 3 回答
- 0 关注
- 165 浏览
添加回答
举报