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

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

WBOY
Release: 2016-06-13 10:11:06
Original
925 people have browsed it

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

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

就是用 $i
------解决方案--------------------
HTML code
Copy after login
    {for $foo=1 to 5} {if $foo lt 3}
  • {$foo}
  • {/if}{/for}
//输出
  • 1
  • 2
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template