我的电报机器人出了问题。在其中一个命令的响应中,它不断地发送一条消息。之前我遇到过这个问题,我用http_response_code(200);
解决了这个问题,但这次使用它们并没有变得更好。
这是发送该消息的代码部分:
elseif ($textmessage == 'command')
$forceReply0 = array(
'force_reply' => true
);
$forceReply = json_encode($forceReply0);
SendMessage($chat_id,'<message>',$forceReply,$message_id);
$newPublisherID = $chat_id;
$GLOBALS['newPublisherID'] = $newPublisherID;
try{
$connection=newPDO(<connection detail>);
$prepared = $connection->prepare(<sql query>);
$prepared->execute($newPublisherID);
}catch(PDOException $e){
//error text info
$errorDetail = $e.getMessage();
}
}