Home >Backend Development >PHP Tutorial >Smarty的循环,使用比较操作符控制循环解决方案

Smarty的循环,使用比较操作符控制循环解决方案

WBOY
WBOYOriginal
2016-06-13 10:11:06922browse

Smarty的循环,使用比较操作符控制循环
使用smarty循环数组也会,但是要实现一个通过比较操作符来控制循环的形式来实现循环。
举例如下:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->for($i = 0 ;$i 

就是用 $i
------解决方案--------------------
HTML code

    {for $foo=1 to 5} {if $foo lt 3}
  • {$foo}
  • {/if}{/for}
//输出
  • 1
  • 2
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