Home Backend Development PHP Tutorial Overview of using the foreach tag in ThinkPHP_PHP Tutorial

Overview of using the foreach tag in ThinkPHP_PHP Tutorial

Jul 13, 2016 am 10:26 AM
thinkphp Label

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

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824726.htmlTechArticleThe foreach tag of ThinkPHP template is used to loop the output data set in the template or traverse the object. Compared with the volist tag, the foreach tag does not have as many functions as the volist tag...
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run thinkphp project How to run thinkphp project Apr 09, 2024 pm 05:33 PM

How to run thinkphp project

There are several versions of thinkphp There are several versions of thinkphp Apr 09, 2024 pm 06:09 PM

There are several versions of thinkphp

How to search for text across all tabs in Chrome and Edge How to search for text across all tabs in Chrome and Edge Feb 19, 2024 am 11:30 AM

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

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

How to run thinkphp

How to install thinkphp How to install thinkphp Apr 09, 2024 pm 05:42 PM

How to install thinkphp

Which one is better, laravel or thinkphp? Which one is better, laravel or thinkphp? Apr 09, 2024 pm 03:18 PM

Which one is better, laravel or thinkphp?

Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks Development suggestions: How to use the ThinkPHP framework to implement asynchronous tasks Nov 22, 2023 pm 12:01 PM

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? How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? Mar 22, 2024 am 10:28 AM

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

See all articles