専門家のアドバイスを求めていますが、foreach が 3 次元配列を走査するとき、最初の子しか走査できないのはなぜでしょうか。
<br /> <tbody><br /> <?php $count=0 ;$countParent=0 ; if(isset($monitorList)){ foreach($monitorList as $key=>$val){<br /> ?><br /> <tr class="treegrid-<?=$key+1+$count?>" style="cursor: pointer;"><br /> <td><?=$val['id']?></td><br /> <td title=<?=$val['name']?> onclick="task(<?=$val['id']?>,'<?=$val['name']?>')"><?=Util::msubstr($val['name'],0,16,'gbk')?></td><br /> <td><?if(!empty($val[$key])){echo count($val[$key]);}else{echo $val['product_qty'];}?></td><br /> <td><?=date("Y-m-d ",strtotime($val['date_start']))?></td><br /> <td><?=$val['plan_director_name']?></td><br /> <br /> <td style="padding: 0px;"><br /> <span><?switch($val['status']){case 1: echo '10%';break;case 9: echo '100%';default: echo ((intval($val['status'])-1)*20).'%';}?></span><br /> <div id="progressouter" style=" border:2px solid red; height:10px; width: 64px;display:block"><div id="progressinner" style="position: relative; width:<?switch($val['status']){case 1: echo '10';break;case 9: echo '100';default: echo ((intval($val['status'])-1)*20);}?>%; height:6px; background:#23bd00;"></div></div><br /> </td><br /> <td><br /> <a style="cursor: pointer;" onclick="window.location.href='/opt_monitoring/show.candor?plan_type=<?=$val['plan_type']?>&workcenter_id=<?=$val['workcenter_id']?>&plan_id=<?=$val['id']?>'" id="show"><br /> 查看</a> <br /> </td><br /> </tr><br /> <?php <br /> $countParent=$key+1+$count;$child=0;<br /> if(is_array($val[$key]))foreach($val[$key] as $v){ //这里只执行了一次<br /> if($val['id']==$v['parent_id']){<br /> $count=$count+1;$child=$child+1;<br /> ?><br /> <tr class="treegrid-<?echo $countParent+$child?> treegrid-parent-<?=$countParent?>"><br /> <td><?=$v['id']?></td><br /> <td><?=Util::msubstr($val['name'],0,16,'gbk')?></td><br /> <td><?=1?></td><br /> <td><?=date("Y-m-d ",strtotime($v['date_start']))?></td><br /> <td><?=$val['plan_director_name']?></td><br /> <td style="padding: 0px;"><br /> <span><?if($v['status']=='1'){echo '10%';}else if($v['status']=='9'){echo '100%';}else{ echo ((intval($v['status'])-1)*20).'%';}?></span><br /> <div id="progressouter" style=" border:2px solid red; height:10px; width: 64px;display:block"> <div id="progressinner" style="position: relative; width:<?if($v['status']=='1'){echo '10';}else if($v['status']=='9'){echo '100';}else{ echo ((intval($v['status'])-1)*20);}?>%; height:6px; background:#23bd00;"></div></div><br /> </td><br /> <td><?=$v['status']?></td><br /> </tr><br /> <?}<br /> }<br /> }}?><br /> </tbody><br />