标签: php smarty while-loop
我正在使用智能版本2的系统中构建一些东西。我正在编写的代码需要使用while循环,但是,版本3之前不会引入while循环。
while
您可以使用while或for之类的内容模拟foreach循环吗?也许循环使用两个条件或提前爆发?我有什么选择?
for
foreach
PS:安装插件以提供while循环功能不是一种选择。
答案 0 :(得分:2)
for循环while循环是这样的:
for(;(put your while condition here);){ }
演示:http://codepad.org/KPBUk4ZN
Read here for converting native PHP to smarty