Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Latest commit

 

History

History
47 lines (36 loc) · 771 Bytes

while.md

File metadata and controls

47 lines (36 loc) · 771 Bytes

While 循环

QueryPHP 支持 while 语法标签,通过这种方式可以很好地将 PHP 的 while 语法布局出来。

code

我们在模板中写下如下的代码:

{~$i = 10}
{while $i>0}   
    {$i}Hello QueryPHP !<br>   
    {~$i--}   
{/while} 

模板编译后的结果:

<?php $i = 10; ?>
<?php while ($i>0): ?>
    <?php echo $i; ?>Hello QueryPHP !<br>
    <?php $i--; ?>
<?php endwhile; ?>

node

我们在模板中写下如下的代码:

{~$i = 10}
<while condition="$i gt 0">   
    {$i}Hello QueryPHP !<br>   
    {~$i--}   
</while>

模板编译后的结果:

<?php $i = 10; ?>
<?php while ($i > 0): ?>
    <?php echo $i; ?>Hello QueryPHP !<br>
    <?php $i--; ?>
<?php endwhile; ?>