Home > Article > Backend Development > Can foreach be used in PHP templates like this? Is this a framework written by someone within the company?
<code><?php foreach($bidlist as $vo): ?> <tr class="mt20"> <td><img src="/image/0.png"></a></td> <td>ID:<?=$vo['uid']?></a></td> <td>时间:<?=$vo['auction_datetime']?></td> <td>价格:<?=number_format($vo['price']/100)?></a></td> </tr> <?php endforeach; ?> </code>
This is his framework: Nature
I feel the performance is quite high
<code><?php foreach($bidlist as $vo): ?> <tr class="mt20"> <td><img src="/image/0.png"></a></td> <td>ID:<?=$vo['uid']?></a></td> <td>时间:<?=$vo['auction_datetime']?></td> <td>价格:<?=number_format($vo['price']/100)?></a></td> </tr> <?php endforeach; ?> </code>
This is his framework: Nature
I feel the performance is quite high
Don’t read the manual...
http://php.net/manual/zh/cont...
This writing style looks a bit like cakePHP
This is the syntax that comes with PHP, which is really more convenient. For details, please see: http://php.net/manual/en/cont...
The first floor is correct. My answer is wrong. Deleted
This is originally a writing method supported by native PHP. PHP originally supports the template function, so writing this way can satisfy those Virgo template control. In fact, I think it is not necessary at all. The curly braces {} are so good, and the editor also has highlight matching. Show.
This is the syntax of php itself, foreach: endforeach; for: endfor; if: endif; etc.
I glanced at your colleague’s framework and saw that the writing was okay. Let’s continue. Haha.