【发布时间】:2011-05-12 12:52:02
【问题描述】:
下表完整地打印出一条评论 (($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 应该得到他对下面其他人回答的评论的信任。
【问题讨论】:
-
Truncate a multibyte String to n chars 的可能重复项 - 包含在不考虑单词边界的情况下截断字符串的解决方案。
-
lol..4 的答案完全相同。