6
我在寻找最快解决方案,以split将字符串转换为零件,而不是word-wrap。str_split不带自动换行
$strText = "The quick brown fox jumps over the lazy dog";
$arrSplit = str_split($strText, 12);
// result: array("The quick br","own fox jump","s over the l","azy dog");
// better: array("The quick","brown fox","jumps over the","lazy dog");
+1非常狡猾。 – 2012-03-10 17:28:33
注意:使用false(默认)作为第四个参数可防止包装时单词被破坏。正是我需要的。如果你不关心破坏单词,请将其设置为true。 – rncrtr 2013-04-12 22:54:52