1

我想做一个简单的问题和多项选择的答案,我想要的结果就像这张图片:这是想要的多选按钮的图片,
但结果不像我想要的这是我的结果图片代码:这是不想要的结果的图片
,这是我尝试过的代码:

<?php
$token = "##################################";
$website = "https://api.telegram.org/bot".$token;

$array = array(array("1","2","3"));
$btn = array("keyboard" => $array,"hide_keyboard" => true,'selective' => true,);
$reply = json_encode($btn);
$url = $website."/sendmessage?chat_id=$chatIdtext=select : &reply_markup=".$reply;
file_get_contents($url);
?>
4

1 回答 1

0

试试这段代码,也许结果就像你想要的那样。

<?php
$token = "######################################";
$website = "https://api.telegram.org/bot".$token;

$name1 = 'das';
$name2 = 'dsa';
$placeId1 = '1';
$placeId2 = '2';
$keyboard = [
            'inline_keyboard' => [[['text' =>  $name1, 'callback_data' => $placeId1]], [['text' =>  $name2, 'callback_data' => $placeId2]]],
        ];

$reply = json_encode($keyboard);
$url = $website."/sendmessage?chat_id=130434215&text=select : &reply_markup=".$reply;
file_get_contents($url);
?>
于 2016-07-14T05:50:25.583 回答