我需要使用 Telegram Bot 发送包含表情符号的消息。
所以我复制/粘贴表情符号代码 :nine:
例如,在我的消息文本中并将其发送给用户,但表情符号不起作用。
这是我的示例代码和功能:
function tel_send($key, $t, $c)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.telegram.org/bot" . $key . "/sendMessage");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "cache=" . (time() / rand(1, time() - 100)) . "&text=" . $t . "&chat_id=" . $c);
$ss = curl_exec($ch);
curl_close($ch);
return $ss;
}
tel_send($key, "My number - :nine:", $val['message']['chat']['id']);
所以,我的问题是:如何通过 Telegram 机器人发送表情符号?
原文由 Vlmake 发布,翻译遵循 CC BY-SA 4.0 许可协议
您需要指定表情符号的 unicode 值。
在这里检查
这些是由一个函数作为表情符号值返回的,比如 u’\U000026C4’ 这是雪人。虽然它是在 python 中,但你可以将它应用于 php。