Home >Backend Development >PHP Tutorial >Can foreach be used in PHP templates like this? Is this a framework written by someone within the company?

Can foreach be used in PHP templates like this? Is this a framework written by someone within the company?

WBOY
WBOYOriginal
2016-08-20 09:04:131022browse

<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

Reply content:

<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 cakePHPCan foreach be used in PHP templates like this? Is this a framework written by someone within the company?

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.

Statement:
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