首页 > 解决方案 > 如何使用 php 使用带有电报 api 的内联按钮

问题描述

我在使用内联按钮时遇到了麻烦,我的问题是我不知道如何处理查询回调,谁能帮我使用它

这是我的代码

<?php
include (__DIR__ . '/vendor/autoload.php');
include 'Telegram.php';
$telegram = new Telegram('567725887:AAHSXeASo7ykp1E5xjSfjKlj4orbCyrG29Q');
$chat_id = $telegram->ChatID();



$option = array( 
    //First row


 array($telegram->buildInlineKeyBoardButton("Button 1", $url="http://link1.com"), $telegram->buildInlineKeyBoardButton("Button 2", $url="http://link2.com")), 
    //Second row 
    array($telegram->buildInlineKeyBoardButton("Button 3", $url="http://link3

.com"), $telegram->buildInlineKeyBoardButton("Button 4", $url="http://link4.com"), $telegram->buildInlineKeyBoardButton("Button 5", $url="http://link5.com")), 
    //Third row
    array($telegram->buildInlineKeyBoardButton("Button 6", $url="http://link6.com")) );
$keyb = $telegram->buildInlineKeyBoard($option);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "This is a Keyboard Test");
$telegram->sendMessage($content);

标签: phpphp-telegram-bot

解决方案


推荐阅读