下面这几个方法将能够帮你解决这个问题。
PHP版将html中的
换行符转换为文本框中的换行符:
function br2nl($text){
return preg_replace('/
/i','',$text);
}
或者:
function br2nl($text){
$text=preg_replace('/
/i',chr(13),$text);
return preg_replace('/ /i',' ',$text);
}
JS版将html中的
换行符转换为文本框中的换行符:
function br2nl(txt){
var re=/(
|
|
|
)/g;
var s=txt.replace(re,"\n");
return s;
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn