gpt4 book ai didi

javascript - 在 Codeigniter 中将输出限制为仅 3 行

转载 作者:行者123 更新时间:2023-11-30 16:26:15 25 4
gpt4 key购买 nike

如何将内容限制为只有一定数量的字符。我想将行数限制为 3 行,每行 6 个单词,并在下一行中显示接下来的 6 个单词。 $row->openletter 给我超过 1000 个单词的完整结果。我已经在 Controller 中加载了文本助手。请找到我想要实现的附加图像。我如何限制 $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>";
}
?>

enter image description here

最佳答案

试试这个

$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 )

Phpfiddle Preview

关于javascript - 在 Codeigniter 中将输出限制为仅 3 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34102239/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com