The example of this article describes the usage of thinkphp loop structure. Share to everyone for your reference. The implementation methods are as follows:
Circular structure in which the variable is not added with the $ symbol in the loop output
Instance 1.for
Copy Code code as follows:
<table border= ' 1 ' width= ' >
<for start= ' 0 ' end= ' name= ' j ' step= '-2 ' comparison= ' GT ' >//lt the positive sequence step is the step value plus the 2/GT reverse output step is the pace value minus 2
<tr><td>{$j}</td><td>abc</td></tr>
</for>
</table>
instance 2.volist
Copy Code code as follows:
<volist name= ' list ' id= ' V ' >//loop multidimensional Array, v represents current array
{$v .username}<br/>
</volist>
Instance 3.foreach
Copy Code code as follows:
<foreach name= ' list ' item= ' V ' key= ' K ' >
{$k}-------{$v}<br/>
</foreach>
I hope this article will be helpful to everyone's thinkphp framework program design.