我想在TelegramBot中发送一张随机照片,我写了这段代码,但它不起作用。我该如何解决这个问题?
$pictures = [
[
"file"=>"data/pictures/pic1.jpg",
],
[
"file"=>"data/pictures/pic2.jpg",
]
];
$random_image = $pictures[rand(0, count($pictures) - 1)];
if ($text == "pictest"){
Bot('SendPhoto',[
'chat_id' => $chat_id,
'photo' => $random_image,
]);
}
在这里,我们可能会失踪:
domain.org/data/pictures/pic1.jpg
file
的$random_image
指数
$pictures = [
[
"file" => "data/pictures/pic1.jpg",
],
[
"file" => "data/pictures/pic2.jpg",
],
];
$random_image = $pictures[rand(0, count($pictures) - 1)]["file"];
if ($text == "pictest"){
Bot('SendPhoto',[
'chat_id' => $chat_id,
'photo' => $random_image,
]);
}