本文介绍了用< br>替换换行符 - PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我猜这是你可以在PHP中做的事情。我想要的是在按下提交按钮时将文本内容放入文本框中,并将所有换行转换为

I'm guessing this is something you can do in PHP. What I want is to get the text in a textfield when the submit button is pressed and convert all the newlines into

<br>'s.

请帮忙吗?

Help, please?

推荐答案

会做你想做的事,我想。

nl2br would do what you want, I think.

<?php
$str = "\n\nfoo\nbar";
echo nl2br($str);

输出:

<br />
<br />
foo<br />

这篇关于用&lt; br&gt;替换换行符 - PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 18:46
查看更多