1

我正在尝试使用带有此 URL 的 Telegram API 发送文本,例如“Hello # World”:

https://api.telegram.org/bot'token'/sendMessage?chat_id='chatid'&text=Hello+#+World

但我只是收到Hello

我也尝试这样编码:

https://api.telegram.org/bot'token'/sendMessage?chat_id='chatid'&text=Hello+%23+World

但我只是收到Hello %23 World

有什么办法可以接收Hello # World吗?感谢:D

4

1 回答 1

0

您没有正确地对字符串进行 url 编码,它应该是

Hello%20%23%20World

而是关闭

Hello+%23+World

完整网址:

https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=<CHAT-ID>&text=Hello%20%23%20World

在此处输入图像描述

于 2020-12-22T16:00:36.137 回答