0

如果该行对于 textarea 很长并且有一个中断,我希望它在其前面放置一个大于号。如何?如您所见,缺少两个greater-than signs

> Vivamus ullamcorper adipiscing bibendum. 
> 
> Etiam faucibus facilisis tortor, 
> in viverra nulla condimentum eu. 
> Vivamus eu tellus adipiscing, molestie nisi vel, 
malesuada lacus. (wheres the greater-than sign?)
> 
> Integer cursus malesuada 
consectetur. (wheres the greater-than sign?)
> Curabitur tellus mi, tristique vel urna et, auctor tincidunt augue. 
> Cras semper, nisl sodales viverra volutpat. 
> Phasellus feugiat quam nec orci 
> accumsan gravida ut vitae risus.

我试过这个:rtrim("> ".str_replace("\n", "\n> ", $str), ">\n");

4

1 回答 1

0

您可以为此使用自动换行

rtrim("> ".str_replace("\n", "\n> ", wordwrap($str, $cols -2 , "\n", true)), ">\n");

只需确保 $cols 与您的文本区域的 col 属性相匹配。我减去 2 来说明要添加的 '> '

于 2013-07-19T21:06:16.560 回答