我在Telegram Bot中工作,该Bot从数组中获取随机数并将其输出,但是还有另外一个if语句,其中一个sendMessage函数没有响应。 我有很多类似的if语句,它们可以正常工作。
if else语句:
if(strpos($message,"/rand")===0){
sendMessage($chatId, '<b>Getting a number...</b>');
sendMessage($chatId,'<b>Number</b>: <i>' .$result. '</i>%0A%0A');
sendMessage($botGroupId,'@'.$username.'/'.$userId. ' has used ' .$message. ' command');
}
用户未从if else语句中收到此消息:
sendMessage($chatId,'<b>Number</b>: <i>' .$result. '</i>%0A%0A');
这是我从数组中获取随机数的方式:
include 'randnum.php';//get content from php files --> include the php file...
$getindex_from_array=array_rand($randnumbers); //gen random index
$result=$randnumbers[$getindex_from_array]; //get a random number from gen index
//end
这是我如何在数组(randnum.php)中添加数字:
<?php
$randnumbers=array("44534","347467","4734856","475348568");
?>