gpt4 book ai didi

arrays - 如何在 Twig 模板中设置数组值

转载 作者:行者123 更新时间:2023-12-05 00:27:11 32 4
gpt4 key购买 nike

如何通过 Twig 模板中的字符串索引更改数组值?我想:

{% do params['redirect_uri'] = 'http://site.loc/' %}

但我收到下一个错误:
Unexpected token "operator" of value "=" ("end of statement block" expected) in
BWUserBundle:User/social:sign-in-thumbs.html.twig at line 4

我也在尝试:
{% set params['redirect_uri'] = 'http://site.loc/' %}

但也有错误:
Unexpected token "punctuation" of value "[" ("end of statement block" expected) in 
BWUserBundle:User/social:sign-in-thumbs.html.twig at line 4

有任何想法吗?

最佳答案

关于什么,

{% set params = params|merge({'redirect_uri': 'http://site.loc/'}) %}

关于arrays - 如何在 Twig 模板中设置数组值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21113197/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com