Home > Article > Backend Development > Traversal method of multi-dimensional array in thinkPHP
The example in this article describes the traversal method of multi-dimensional arrays in thinkPHP. Share it with everyone for your reference, the details are as follows:
$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')), );
<foreach name="drugs" item="vo" key="k"> <label> <input type="checkbox" name="{$k}" value="1">{$k} </label> <foreach name="vo" item="drug"> <label> <input type="checkbox" name="{$drug.en_name}" value="1">{$drug.ch_name} </label> </foreach> </foreach>
For more related content about thinkPHP, you can check out the special topics on this site: "Introduction to ThinkPHP Tutorial" and "Summary of Common Methods of ThinkPHP"
I hope that what this article describes will be helpful to everyone PHP programming based on the thinkPHP framework helps.
The above introduces the traversal method of multi-dimensional arrays in thinkPHP, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.