我在 Telegram 中的 PHP 中创建了一个机器人,其中有 2 个内联按钮。我收到了正确的点击,但是在我如何发回另一条消息之后?使用下面的代码,我可以发送一条消息,但在这种情况下它不起作用。
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if(!$update) {
exit;
}
header("Content-Type: application/json");
$chatId = isset($message['chat']['id']) ? $message['chat']['id'] : "";
$callback_query = isset($update['callback_query']) ? $update['callback_query'] : "";
if($callback_query["data"]=='1'){
$parameters = array('chat_id' => $chatId, "text" => '1');
$parameters["method"] = "sendMessage";
echo json_encode($parameters);
exit;
}