电报错误的内联键盘错误400不良请求
我想发送一个编码键盘作为回复标记,但我会收到错误400不好的requset!
这就是JSON的样子:
{"inline_keyboard":[[{"text":"Play, Guitar, Play - \u003Cspan style=\"font-size:14px;\"\u003E Conway Twitty ","callback_data":"some url"}]]}
这就是代码的样子:
// Create keyboard
$keyboard = json_encode([
"inline_keyboard" => [
$innerdata,
]], true);
$url = "https://api.telegram.org/bot$token/sendMessage?chat_id=$chat_id&text=Choose&reply_markup=".$keyboard;
$res = file_get_contents($url);
break;
我还尝试删除其中一个[] [] ,但它不起作用。
I wanna send a json encoded keyboard as reply markup but I get error 400 bad requset!
This is how json looks like:
{"inline_keyboard":[[{"text":"Play, Guitar, Play - \u003Cspan style=\"font-size:14px;\"\u003E Conway Twitty ","callback_data":"some url"}]]}
and this is how the code looks like:
// Create keyboard
$keyboard = json_encode([
"inline_keyboard" => [
$innerdata,
]], true);
$url = "https://api.telegram.org/bot$token/sendMessage?chat_id=$chat_id&text=Choose&reply_markup=".$keyboard;
$res = file_get_contents($url);
break;
I've also tried deleting one of the [ ] but it didn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际上发现了问题。这是数据大小的问题。正如Telegram所说,回调数据不应超过64个字节
,并且可以通过:
I actually find the problem. It was a problem with data size. As Telegram says, the callback data should not be more than 64 bytes
And it can be fixed by: