开发者

What's the difference between {foreach} and {section} in smarty?

开发者 https://www.devze.com 2023-01-22 17:46 出处:网络
Can someone provide an example that make i开发者_StackOverflowt clear?{foreach} is used to loop over an associative array as well a numerically-indexed array,

Can someone provide an example that make i开发者_StackOverflowt clear?


{foreach} is used to loop over an associative array as well a numerically-indexed array,

{section} which is for looping over numerically-indexed arrays only

The syntax for {foreach} is much easier than {section}, but as a tradeoff it can only be used for a single array


You may take a look at the documentation which explains the differences and provides examples.


From the manual:

the syntax for {foreach} is much easier than {section}, but as a tradeoff it can only be used for a single array.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号