Nothing left to worry about. I saw an article on php form conversion textarea line break on the Internet. After reading the article, I feel that some information in this article is not accurate based on my past experience... as a result, I personally obtain form data from php.
Nothing left to worry about. I saw an article on php form conversion textarea line break on the Internet. After reading the article, I feel that some information in this article is not accurate based on my past experience... as a result, I personally obtain form data from php.
Test Page code:
The Code is as follows:
PHP retrieves line breaks in form area data
$ Content = empty ($ _ POST ['content'])? Null: trim ($ _ POST ['content']);
If (! Empty ($ content) echo str_replace ("\ r", 'rl ', nl2br ($ content ));
Echo "\ r ".'
---------- Split line -------------------- '. "\ r ";
If (! Empty ($ content) echo str_replace ("\ n", 'nl ', nl2br ($ content ));
Echo "\ n ".'
---------- Split line -------------------- '. "\ n ";
If (! Empty ($ content) echo str_replace ("\ r", 'rl ', str_replace ("\ n", 'nl', nl2br ($ content )));
Echo "\ r ".'
---------- Split line ----------------------
'. "\ N ";
Echo 'Hello'. "\ n". 'Boys! ';
Echo 'Hello'. "\ r". 'Boys! ';
?>
Open it in the browser and enter the following in the form:
After you press submit, the browser displays the following results:
In notepad Coco, you can see the following results:
The preceding results show that:
1. the PHP function nl2br () inserts an HTML line break before each new line (\ r \ n) in the string:
;
2. In Windows, the line feed is (\ r \ n );
3. In notepad, \ r or \ n have the line feed function;
, Hong Kong Server rental, server space, server space