Home  >  Article  >  php教程  >  thinkPHP简单遍历数组方法分析,thinkphp遍历数组

thinkPHP简单遍历数组方法分析,thinkphp遍历数组

WBOY
WBOYOriginal
2016-06-13 08:39:341620browse

thinkPHP简单遍历数组方法分析,thinkphp遍历数组

本文实例分析了thinkPHP简单遍历数组方法。分享给大家供大家参考,具体如下:

有如下数组:

array(
  array(
    'id'=>1,
    'username'=>'mgckid',
    'sex'=>1
  )
  array(
    'id'=>2,
    'username'=>'yezi',
    'sex'=>0
  )
)

thinkphp模版标签写法:

<volist name='data' id='vo'>
  <{$vo.id}>---------<{$vo.username}>-----------<{$vo.sex}><br/>
</volist>

遍历结果:

1---------mgckid-----------1
2---------yezi-----------0

附上织梦标签写法对比加强理解:

{dede:arclist typeid='20' row='5' titlelen='40'}
  [field:title/]  [field:arcurl/] [field:pubdate/] [field:infos/] [field:writer/]
{/dede:arclist}

补充:小编在这里推荐一款本站的php格式化美化的排版工具帮助大家在以后的PHP程序设计中进行代码排版:

php代码在线格式化美化工具:http://tools.jb51.net/code/phpformat

更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《ThinkPHP入门教程》、《ThinkPHP常用方法总结》、《smarty模板入门基础教程》及《PHP模板技术总结》。

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

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