使用电报的 HTTP API 在 PHP 中发送消息,如下所示:
$msg = "New Comment is **added** from:\n".$domain; file_get_contents('https://api.telegram.org/botTOKEN:CODE/sendMessage?chat_id=@MYCHANNEL&text='.$msg.'&parse_mode=markdown');
仅添加最后一个参数&parse_mode=markdown
会导致 400 错误请求。删除它,一切正常。
但是,\n
从$msg
字符串中删除使其工作正常。
现在,我不知道为什么新行\n
会导致 400 bad request。另外,我不知道如何在消息正文中添加新行!
慕无忌1623718