我有这个用于创建动态键盘的代码段:
$keyboard_array = [];
foreach ($verse_arr['items'] as $item) {
$keyboard_array[] = ["text" => '"'. $item['poem']['verse-r'] . '
' . $item['article']['verse-l'] . '
' . $item['article']['poet'] . '
' . $item['article']['book'] . '"' , "callback_data" => '"'.$item['article_id'].'"'];
}
$current = print_r($keyboard_array,true);
$file = 'keyboard.log';
file_put_contents($file, $current);
apiRequestJson("sendMessage", array('chat_id' => $chat_id, "text" => "Search results: ", 'reply_markup' => new InlineKeyboardMarkup(
[
'inline_keyboard' => [$keyboard_array]
])));
正如您在第8-10行中所看到的,我将结果写入文件,一切看起来都很好。但是这个消息并没有通过。顺便说一句,文字是UTF-8和波斯语。
我希望你能帮助我。
此致