Traversal method of multi-dimensional array in thinkPHP, thinkphp multi-dimensional array_PHP tutorial

WBOY
Release: 2016-07-12 09:01:11
Original
982 people have browsed it

The traversal method of multi-dimensional arrays in thinkPHP, thinkphp multi-dimensional array

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')),
);

Copy after login
<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>

Copy after login

For more information related to thinkPHP, please view the special topics on this site: "Introduction to ThinkPHP Tutorial" and "Summary of Common Methods of ThinkPHP"

I hope this article will be helpful to everyone’s PHP programming based on the thinkPHP framework.

Articles you may be interested in:

  • thinkphp data query and array traversal examples
  • ThinkPHP writing array insertion and getting the latest inserted data ID example
  • Thinkphp Summary of methods for converting two-dimensional arrays into one-dimensional arrays suitable for labels
  • Array loop examples in ThinkPHP templates
  • ThinkPHP query returns simple field arrays
  • thinkphp implements array paging Example

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1089931.htmlTechArticlethinkPHP’s traversal method of multi-dimensional arrays, thinkphp multi-dimensional array 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=a...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!