仍然得到< br>在textarea [英] Still get <br> in textarea

查看:80
本文介绍了仍然得到< br>在textarea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在html中有一个文本区域。然后我填写这个taxt区域就像这样

I have a text area in html. Then I fill this taxt area like this

Line 1
Line 2
Line 3

但是在后期,我得到这样的结果:

But in post, I get like this :

echo $_POST['textarea'] ;

===> 1行2行3

===> Line 1Line 2 Line3

我如何得到这样的结果:

How can I get like this :

Line 1 <br>
Line 2 <br>
Line 3 <br>


推荐答案

使用 nl2br - 在字符串中的所有换行符之前插入HTML换行符

Use nl2br — Inserts HTML line breaks before all newlines in a string

echo nl2br($_POST['textarea']);

这篇关于仍然得到&lt; br&gt;在textarea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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