function subtext($text, $length)
{
if(mb_strlen($text, 'utf8') > $length) {
return mb_substr($text, 0, $length, 'utf8').'...';
} else {
return $text;
}
}
$str = '风风光光vvvv仿佛从vv的地方vv吹吹风方法吃吃吃vv兴冲冲vv的风格c吃虚构c分层次感vv分vv尺寸从vvvc c ';
echo subtext($str, 10); //风风光光vvvv仿佛...