PHP:电报机器人:在文本消息中插入换行符

问题描述:

"\n""\r\n"在电报bot发送的文本消息中进行了测试,以创建换行符.在使用下划线_之后,将显示下划线_,而不是显示换行符.

"\n" and "\r\n", tested in text message sent by telegram bot, to create line break. Instead of showing line break, underline _ will appear after using them.

如何在bot发送的电报消息中打印换行符?

How I could printing line feed in telegram message sent by bot?

CODE

CODE

$txt = 'با تشکر از عضویت شما، هر روز حدود ساعت 10 شب یک ویدئوی جالب برای شما ارسال خواهد شد.';
$txt .= " \n ";
$txt .= 'Thanks for joining, Every day at almost 18:30 GMT an intersting video will be sent';

消息演示

任何帮助将不胜感激.

有更好的方法!问题是由于URL编码... 您可以使用\n使用普通的PHP文本,但可以将其传递给urlencode方法,如下所示:

There is a better way! The problem is because of URL encodings... You can use normal PHP text using \n but by passing it to urlencode method, as follows:

$txt = urlencode("here is my text.\n and this is a new line \n another new line");

对我有用!