【问题标题】:Use Markdown code block in Telegram PHP API在 Telegram PHP API 中使用 Markdown 代码块
【发布时间】:2021-04-17 07:47:02
【问题描述】:

我想用 PHP 语言的电报机器人发送code block
我已经使用了“`”,但我没有得到任何结果。

我使用 HTML parse_mode。

【问题讨论】:

    标签: php html markdown telegram telegram-bot


    【解决方案1】:

    有 2 个格式选项:https://core.telegram.org/bots/api#formatting-options

    另见 sendMessage 中的 parse_mode:https://core.telegram.org/bots/api#sendmessage

    您应该在此参数中设置它,然后使用并发格式(在您的情况下为降价)

    UPD 如果你使用 html 模式,使用<code> 用于内联块,<pre> 用于多行

    【讨论】:

    • 他可以使用parse_mode = html<pre>标签来格式化代码。
    • 如果问题中出现像“`”这样的内联块
    猜你喜欢
    • 2020-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-07
    • 2012-11-24
    相关资源
    最近更新 更多