本文实例讲述了thinkPHP中多维数组的遍历方法。分享给大家供大家参考,具体如下:
1
2
3
4
5
6
7
|
$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' => 'jb51' , 'en_name' => 'candesartan' ), array ( 'ch_name' => 'PHP学习' , 'en_name' => 'losartan' ), array ( 'ch_name' => 'JS学习' , 'en_name' => 'valsartan' ), array ( 'ch_name' => '脚本教程' , 'en_name' => 'irbesartan' )), ); |
1
2
3
4
5
6
7
8
9
10
|
< 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 > |
希望本文所述对大家基于thinkPHP框架的PHP程序设计有所帮助。