gpt4 book ai didi

php - 将评论限制为 250 个字符

转载 作者:行者123 更新时间:2023-11-29 01:12:21 25 4
gpt4 key购买 nike

下表完整地打印了一条注释 (($rowquote["comment"]))。如何将其限制为 250 个字符?

提前致谢

约翰

echo "<table class=\"samplesrec1quote\">";
while ($rowquote = mysql_fetch_array($resultquote)) {
echo '<tr>';
echo '<td class="sitename1quote">"'.stripslashes($rowquote["comment"]).'"</td>';
echo '</tr>';
}
echo "</table>";

编辑: 我让它在查询中与 left(comment, 250) 一起工作。所以我猜 jensgram应该相信他对下面其他人的回答所做的评论。

最佳答案

或者,您可以在 MySQL 端执行此操作并节省一点带宽。

select substring(comment, 0, 250) as comment

代替

select comment

关于php - 将评论限制为 250 个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4223591/

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