如何在电报机器人使用php的注释中使用回调

时间:2019-09-22 07:11:27

标签: php

$reply  = $name . "\n" . $price . " افغانی " . "\n\n";

$reply .= "/booking"   . $id . "  ?  " . "خرید" . "\n" ;
$reply .= "/delete" . $id . "  ?  " . "حذف"    . "\n\n";

$url = $GLOBALS['bot_url'] . "/sendPhoto";
$post_params = [
    'chat_id' => $GLOBALS['chat_id'],
    'photo'   => new CURLFile(realpath($image_url)),
    'caption' => $reply
];
send_reply($url, $post_params);
}

$connection->close();

//---------------------

$inline_keyboard = [
    [
        ['text' => "ثبت محصول جدید", 'callback_data' => "add_new_product"]
    ]
];

$inline_kb_options = [
    'inline_keyboard' => $inline_keyboard
];

$json_kb = json_encode($inline_kb_options);
$reply   = "?جهت افزودن محصول جدید دکمه زیر را لمس کنید?";
$url = $GLOBALS['bot_url'] . "/sendMessage";
$post_params = ['chat_id' => $GLOBALS['chat_id'], 'text' => $reply, 'reply_markup' => $json_kb];
send_reply($url, $post_params);

}

我想在这里'callback_data' => "add_new_product"中使用$reply .= "/booking" . $id . " ? " . "خرید" . "\n";

如何使用?请帮助我

0 个答案:

没有答案