【问题标题】:Iterating through a double array in Mustache遍历 Mustache 中的双数组
【发布时间】:2014-12-16 23:41:05
【问题描述】:

我有一个双数组,我将它传递到我的 Mustache 文件中,前两个级别按数字索引。变量名是{{groups}},所以我可以用{{#groups}}{{/groups}} 遍历外部部分,但每个组中都有一系列问题。

我希望能够遍历每个问题并为每个问题创建一些 html。如果引用是数字的,我该怎么做?

【问题讨论】:

    标签: php mustache mustache.php


    【解决方案1】:

    如果您提供一些代码和/或数据示例,给您答案会更容易,但要点是您需要implicit iterator

    {{# groups }}
      {{# . }}
         <!-- this section will happen once per element in each element of groups -->
      {{/ . }}
    {{/ groups }}
    

    【讨论】:

      猜你喜欢
      • 2014-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-17
      • 2014-08-18
      • 2010-12-14
      • 2023-03-30
      • 2016-01-31
      相关资源
      最近更新 更多