在smarty模板引擎的section循环中

$data=[101,102,103,105,104];

  section的两个属性total与loop

{section foo $data start=1 step=2}
  {$smarty.section.foo.total}--输出2
  {$smarty.section.foo.loop}--输出5 {
/section}

意即:使用total输出的是循环执行的次数,使用loop输出的是所循环数据的count

相关文章: