Overview of using the foreach tag in ThinkPHP_PHP Tutorial
Jul 13, 2016 am 10:26 AM
The foreach tag of ThinkPHP template is used to loop output data sets or traverse objects in the template.
Compared to the volist tag, the foreach tag does not have as many functions as the volist tag, but it can traverse objects and output , while the volist tag is usually used to output arrays.
The foreach tag is used as follows:
<foreach name="list" item="vo"> 用 户 名:{$vo.username}<br /> 电子邮件:{$vo.email}<br /> 注册时间:{$vo.regdate|date="Y-m-d H:i",###} <hr /> </foreach>
The name in the foreach tag is a required option, indicating the template variable to be output; item is also a required option, indicating the loop unit variable.

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

There are several versions of thinkphp

How to search for text across all tabs in Chrome and Edge

Which one is better, laravel or thinkphp?

Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks

How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to?
