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彷彿...