0
如何在循環中將一個數組中的值插入到另一個數組中? 例如將另一個數組中的值替換爲數組twig
{% for day_item in template_string %}
<div id="{{lessons.{{day_item.template_string}}.id}}" class="col-lg-2 no-padding col-md-2 col-sm-12 col-xs-12"></div>
{% endfor %}
谷歌搜索 「PHP樹枝動態變量」(https://www.google.co.uk/search?q=php+twig+dynamic+variable),最答案似乎圍繞使用屬性函數(https://twig.sensiolabs.org/doc/2.x/functions/attribute.html)。很確定這是你需要的,這個問題只是這些問題的另一個變種?這對你有用嗎? –