search
Homephp教程php手册thinkPHP中多维数组的遍历方法,thinkphp多维数组

thinkPHP中多维数组的遍历方法,thinkphp多维数组

本文实例讲述了thinkPHP中多维数组的遍历方法。分享给大家供大家参考,具体如下:

$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 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相关内容可查看本站专题:《ThinkPHP入门教程》及《ThinkPHP常用方法总结》

希望本文所述对大家基于thinkPHP框架的PHP程序设计有所帮助。

您可能感兴趣的文章:

  • thinkphp数据查询和遍历数组实例
  • ThinkPHP写数组插入与获取最新插入数据ID实例
  • Thinkphp将二维数组变为标签适用的一维数组方法总结
  • ThinkPHP模板中数组循环实例
  • ThinkPHP查询返回简单字段数组的方法
  • thinkphp实现数组分页示例
Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool