在textarea中捕捉换行符(换行符,换行符) [英] Capturing linebreaks (newline,linefeed) characters in a textarea

查看:227
本文介绍了在textarea中捕捉换行符(换行符,换行符)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有< textarea> 的表单,我想在服务器端的该textarea中捕获任何换行符,并用
$ b

p>我尝试在 textarea 的CSS上设置 white-space:pre ,但这还不够。 / p>

解决方案

查看 nl2br() 功能。它应该做你想要的。


I have a form with a <textarea> and I want to capture any line breaks in that textarea on the server-side, and replace them with a <br/>.

Is that possible?

I tried setting white-space:pre on the textarea's CSS, but it's still not enough.

解决方案

Have a look at the nl2br() function. It should do exactly what you want.

这篇关于在textarea中捕捉换行符(换行符,换行符)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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