function mb_cutstr($string, $encode='UTF-8', $repeat='*', $count=3){
$length = mb_strlen($string, $encode);
if($length < 4){
$head = mb_substr($string, 0, 1, $encode);
$foot = ($length > 2)? mb_substr($string, -1, 1, $encode) : '';
}else{
$head = mb_substr($string, 0, 2, $encode);
$foot = mb_substr($string, -1, 1, $encode);
}
return $head . str_repeat($repeat, $count). $foot;
} 最佳答案