在PHP字符串中创建回车? [英] Create Carriage Return in PHP String?

查看:354
本文介绍了在PHP字符串中创建回车?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们为计费系统编写了一个小的PHP挂钩,可在下订单时与我们一起打开新的支持通知单.除了对"Open Ticket" API函数而言,它使用消息的字符串是有效的,但是我们无法弄清楚如何将回车符放入其中.

We have written a small PHP Hook for our billing system that opens a new support ticket with us when an order is placed. It works except that for the "Open Ticket" API function, it takes a string for the message, but we cannot figure out how to put carriage returns in it.

我尝试过

<p>, <br>, \n, \r\n, etc.

尽管它看起来似乎只是纯文本,但所有这些都只是逐字阅读而不是变成回车符.

As it appears to just be completely plain text though, all of these are just being read verbatim rather than made into carriage returns.

有人对如何做到这一点有任何想法吗? http://docs.whmcs.com/API:Open_Ticket

Does anyone have any thoughts on how this could be done? http://docs.whmcs.com/API:Open_Ticket

推荐答案

回车符为"\r".注意双引号!

Carriage return is "\r". Mind the double quotes!

我认为您希望"\r\n" btw在文本中添加一个换行符,以便可以在不同的操作系统中正确呈现该文本.

I think you want "\r\n" btw to put a line break in your text so it will be rendered correctly in different operating systems.

  • Mac:\ r
  • Linux/Unix:\ n
  • Windows:\ r \ n

这篇关于在PHP字符串中创建回车?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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