[英]wordwrap + nl2br = more than you need line breaks?
我在表单中有一个textarea。 没有提供html代码中的换行。 在php文件中(形式为action = phpfile.php),我得到textarea的值,如下所示:
$ad_text=wordwrap(nl2br($_POST['annonsera_text']), 47, '<br>', true);
echo $ad_text;
然后输出是:
hellohellohellohellohellohellohellohellohellohe
llohello.
hi.
hi.
hi.
/> hi.
hi.
hi.
hi.
/>
而textarea形式的原始输入是这样的:
hellohellohellohellohellohellohellohellohellohe
llohello.
hi.
hi.
hi.
hi.
hi.
hi.
hi.
在第三个\\ n之后似乎有一个换行符,后跟一个'/>'
任何想法为什么?
谢谢
wordwrap
不会将<br>
视为换行符-如果在wordwrap之后移动nl2br
,它将nl2br
,但是应将wordwrap参数更改为“ \\ n”以避免双倍行距:
$ad_text = nl2br(wordwrap($_POST['annonsera_text'], 47, "\n", true));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.