Replace the carriage return in textarea with _PHP tutorial

WBOY
Release: 2016-07-13 16:58:35
Original
914 people have browsed it

Replace the carriage return in the textarea with

Today when I was writing a recruitment system, I found that the content submitted directly to the database was no longer in our original format. There were no line breaks, spaces, etc. in each line. After a detailed look, it turned out that we pressed Enter Spaces and spaces cannot be seen in the textarea, but they all have ascii codes. The asc code value of carriage return is 13 and the asc code value of space is 32. It is easy to know this. Let us give an example to illustrate:

$value =str_replace(chr(13),'
',$_POST['textvalue'])//This is to replace the carriage return in the textarea with a line feed, which can be done in html The normal display is the same as the format we have in textarea. Replacing spaces is str_replace(chr(32),'
',$_POST['textvalue'])//

It’s very simple.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631379.htmlTechArticleReplace the carriage return in textarea with br. Today when I was writing a recruitment system, I found that the content should be submitted directly to the database. Our original format is gone, all lines are broken in one line...
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