Home  >  Article  >  Backend Development  >  smarty 里面, foreach 怎么计算上一个元素

smarty 里面, foreach 怎么计算上一个元素

WBOY
WBOYOriginal
2016-06-06 20:16:12881browse

<code class="phtml">


    

</code>

为什么不能计算, $ccc-1 哈? 其中 key 是数组的 .

回复内容:

<code class="phtml">


    

</code>

为什么不能计算, $ccc-1 哈? 其中 key 是数组的 .

好久不用smarty了,是不是$ccc是0


找到正解,用section,$foo[bar]这种仅在{section}循环的语法内可用,foreach不行

smarty 里面,  foreach 怎么计算上一个元素

参考:http://www.php100.com/manual/smarty/language.function.section.html

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
Previous article:微信开发者模式Next article:关于构建大型SPA的疑问