The following methods will help you solve this problem.
The PHP version converts the
line breaks in html to line breaks in the text box:
Copy code The code is as follows:
function br2nl($text){
return preg_replace('/
/i','',$text);
}
or:
Copy code The code is as follows:
function br2nl($text){
$text=preg_replace('/< ;br\s*?/??>/i',chr(13),$text);
return preg_replace('/ /i',' ',$text);
}
The JS version converts the
line breaks in html to line breaks in the text box:
Copy code The code is as follows:
function br2nl(txt){
var re=/(
|
|
|
)/g;
var s=txt.replace(re,"n");
return s;
http://www.bkjia.com/PHPjc/326703.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326703.htmlTechArticleThe following methods will help you solve this problem. PHP version converts br/line breaks in html to line breaks in text boxes: Copy code The code is as follows: function br2nl($text){ ret...