thinPHP中多维数组的遍历

时间:2022-04-16 16:01:54

$drug=array(

   'ACEI'=>array(array('ch_name'=>'卡托普利','en_name'=>'captopril'),array('ch_name'=>'依那普利','en_name'=>'enalapril'),

       array('ch_name'=>'赖诺普利','en_name'=>'lisinopril')),

   

   'ARB'=>array(array('ch_name'=>'依普罗沙坦','en_name'=>'eprosartan'), array('ch_name'=>'坎地沙坦','en_name'=>'candesartan'),

      array('ch_name'=>'氯沙坦','en_name'=>'losartan'),array('ch_name'=>'缬沙坦','en_name'=>'valsartan'),

      array('ch_name'=>'厄贝沙坦','en_name'=>'irbesartan')),

  );

<foreach name="drugs" item="vo" key="k">

    <label class="checkbox">

     <input type="checkbox" name="{$k}" value="1">{$k}

    </label>

     <foreach name="vo" item="drug">

      <label class="checkbox inline drug">

       <input type="checkbox" name="{$drug.en_name}" value="1">{$drug.ch_name}

      </label>

     </foreach>

  </foreach>