Using thinkphp3.2.3, the textarea has been manually entered and newlined, but after submission, the database does not have any newline tags. How to solve it?
認(rèn)證0級講師
Add <pre>
when the page is displayed<pre>{$content}</pre>
As shown in the picture
nl2br($str);
Convert the newline character to <br> and then store it in the database
The space (r) and newline character (n) in the textarea do not display labels in the database. You can use them when displaying the page
<pre>{$content}</pre>
But if a line of content is too long, it will not automatically wrap. You can also convert the textarea's line wrapping to
str_replace("\n", "<br>", $content4);
In this way, the output content will have line breaks.