3
在我的服务枝杈可变我返回一个数组,看起来像这样:表示使用循环
$array = [
'bible_anagram_word' => $result->getBibleAnagramWord(),
'word_1' => $result->getWord1(),
'word_2' => $result->getWord2(),
'word_3' => $result->getWord3(),
...
'word_22' => $result->getWord22(),
'word_23' => $result->getWord23(),
'word_24' => $result->getWord24(),
'word_25' => $result->getWord25(),
'Bible_verse_reference' => $result->getBibleVerseReference(),
'Bible_verse_text' => $result->getBibleVerseText(),
'Bible_translation' => $result->getBibleTranslation(),
];
如何代表document.word _ ##在这个为循环?
{% for i in 1..25 %}
{{ document.word_ ~ i|slice(0,1) }}
{% endfor %}
在PHP这个代码是:
substr ($this->document['word_'.$i] , 0 , 1)
我的不成功的尝试包括:
- {{document.word_〜I |片(0,1)}}
- {{(document.word_〜i)| slice(0,1)}}
- {{'document.word_〜i'| slice(0,1)}}