Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
データベースに改行を含む文字列があります。これを分割して、Web ページの段落として表示したいのですが、データベースのテキストは次のとおりです。
My first paragraph my second paragraph my third paragraph
これを私のWebページに表示したい
Phpには実際にこれのための関数があります: nl2br. だからあなたは言うことができますecho nl2br($str);
nl2br
echo nl2br($str);
<? $str = 'My first paragraph my second paragraph my third paragraph'; $newstr = str_replace('\n','<br>',$str); echo $newstr; ?>