小编Bat*_*ico的帖子

如何在树枝视图中获取数组的键名

我在twig编码,以显示我从PHP获得的值,我希望数组的键名出现在值的上方.

{% if user.address %}
        <tr>
            {% for address in user.address %}
                {% for parts in address %}
                    <td width="25%">
                        {{ parts }}
                    </td>  
                {%endfor%}
            {% endfor %}
        </tr>              
{% endif %}
Run Code Online (Sandbox Code Playgroud)

{% for address in user.address %}我想要的部分 ({{address.key}}或获得数组的键名所需的真实句子)

数组如下:

  -address : array:4 [?
    "Door" => array:1 [?
      0 => "225"
    ]
    "Street" => array:1 [?
      0 => "Pinky street"
    ]
    "District" => array:1 [?
      0 => "District north"
    ]
    "City" => array:1 [?
      0 => …
Run Code Online (Sandbox Code Playgroud)

php arrays array-key symfony twig

4
推荐指数
1
解决办法
268
查看次数

如何在 Telebot(pytelegramBotAPI)中获取 chat_id 和 message_id 以更新电报机器人(Python)中最后发送的消息

这是我的一段代码

bot.edit_message_text(chat_id = CHAT_ID, message_id = MESSAGE_ID, text = "message has been updated", reply_markup=inline_keyboard)
Run Code Online (Sandbox Code Playgroud)

python telegram python-telegram-bot telegram-bot

1
推荐指数
1
解决办法
1万
查看次数