Home > Backend Development > PHP Tutorial > post表单textarea回车获取不到n,该怎么处理

post表单textarea回车获取不到n,该怎么处理

WBOY
Release: 2016-06-13 12:55:20
Original
937 people have browsed it

post表单textarea回车获取不到\n
很纠结,为什么在在textarea中按下回车键能换行,但是保存到数据库只是一个空白的格,没有换行符呢,纠结呀


------解决方案--------------------
那是文本换行符,要在html显示换行,则用nl2br() 下再入库。
------解决方案--------------------
因为你看数据库内容只是用html的工具,而不是用其他能解析\r\n的

<br />
<div><br />
abc<br />
def<br />
</div><br />
Copy after login

在浏览器上你能看到换行么
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template