我希望在html表中显示段落,如果段落超过7个单词,那么它必须有换行符,并且文本必须出现在列的下一行,有人能提出一些想法吗?提前感谢
试试这个:
/* read and print characters, while incrementing "$counter" then include this condition in your loop */
if($counter % 7 == 0)
{
$counter = 0;
echo "<br />";
}
尝试此代码
$array=str_word_count($msg,1);
$i=0;
foreach($array as $ar)
{
echo $ar.' ';
$i++;
if($i==7)
{
echo '<br>';
$i=0;
}
}