Thinkphp array Loop instance in template, thinkphp template
This article describes the implementation of array loops in thinkphp templates. Share to everyone for your reference. The implementation method is as follows:
thinkphp development process is often used in the output array used in the template, the general select out of the data are two-dimensional array, we use the template volist label can be output, today development encountered a problem: if it is a two-dimensional array, how to output in the template? After reviewing the development manual, the problem is solved and shared, such as a one-dimensional array:
Copy the Code code as follows: Array (2) {
[2] = = string () "Www.jb51.net Blog with Picture"
[3] = = string (12) "Default album"
}
With the foreach tag, he can loop one-dimensional or two-dimensional arrays, one-dimensional arrays that use:
Copy the Code code as follows:{$VO}
It is hoped that this article will be helpful to everyone's thinkphp framework design.
thinkphp looping an array on a template I've already set the length of the arrays how to judge the last of the loops
Are you sure you want to go to the total page number? thinkphp with the page display should be {$page}, the default display is the number of n records, the previous page, the next page, the first page, the last page, to show the total page configuration page.class.php in the $config item
How do I combine loops and functions in a thinkphp in a template?
You query this out is a two-dimensional array, in the template has a special label for the loop output, so unnecessary to calculate his length, you directly with Volist this label
Use the following:
Show title: {$vo. Name}
</volist>
The value of name books is the two-dimensional array name you passed in the controller.
http://www.bkjia.com/PHPjc/903477.html www.bkjia.com true http://www.bkjia.com/PHPjc/903477.html techarticle thinkphp Example of an array loop in a template, thinkphp template This article describes the implementation of the array loop in the thinkphp template. Share to everyone for your reference. The concrete implementation method is as follows: ...