如何在文本框中使用换行符?
我正在将文本从数据库中的文本区域保存并将其显示在另一个文本区域中。 换行符显示为 \n 应该是正确的,但文本区域正在显示 他们而不是休息!我该如何解决这个问题?
I am saving text from a textarea in the database and display it in another textarea.
The linebreaks are displayed as \n which should be right, but the textarea is displaying
them instead of doing the breaks! How can I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要发送文字换行符,而不是转义序列。
You need to send a literal line break, not an escape sequence.
谢谢大卫,
这有效...
str_replace('\n', " ", $text);
Thank you David,
this worked...
str_replace('\n', " ", $text);