PHP:电报机器人:在文本消息中插入换行符 [英] PHP: Telegram Bot: Insert line break to text message

查看:926
本文介绍了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");

对我有用!

这篇关于PHP:电报机器人:在文本消息中插入换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆