如何将内容限制为仅特定数量的字符。我想将行数限制为3行,每行6个单词,并在下一行显示下一个6个单词。$ row-> openletter提供了超过1000个单词的完整结果。我已经在控制器中加载了文本帮助器。请找到我想要实现的附件图像。如何限制$ row-> openletter在每行中仅显示6个单词并将行数限制为3个?
<?php
echo "</li>";
echo "</ul>";
echo "</div>";
echo "</div>";
echo "<div class='news-v2-desc'>";
echo "<h3>";
<a href="<?php $this->load->helper('url'); echo base_url();?>index.php/Welcome/indexes?id=<?php $data=$row->open_id; echo $data; ?>">
<?php $ima=$row->title; echo $ima; ?>
</a>
<?php echo "</h3>";
echo "<small>By Admin | California, US | In <a href='#'>Art</a></small>";
echo "<p>";
$string = word_limiter($row->openletter, 4);
echo $string;
echo "</p>";
echo "</div>";
echo "</div>";
}
?>
尝试这个
$para = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.';
$pos = strpos($para, ' ', 200);
echo substr($para,0,$pos )
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句