<?php function cutstr ($data, $no, $le = '...') { $data = strip_tags(htmlspecialchars_decode($data)); $data = str_replace(array("\r\n", "\n\n", "\r\r", "\n", "\r"), '', $data); $datal = strlen($data); $str = msubstr($data, 0, $no); $datae = strlen($str); if ($datal > $datae) $str .= $le; return $str; } ?>
模板:{$vo.content|cutstr=30}
来自:ThinkPHP峰会III(52496225) [广东]Corz