//如果字符串长度超过10,则截取并以省略号结尾
function sub($str){
$str=(string)$str;
if( mb_strlen($str,'utf-8') >10){
return mb_substr($str,0,10,'utf-8').'...';
}else{
return $str;
}
}
2023-08-10 16:01:28
//如果字符串长度超过10,则截取并以省略号结尾
function sub($str){
$str=(string)$str;
if( mb_strlen($str,'utf-8') >10){
return mb_substr($str,0,10,'utf-8').'...';
}else{
return $str;
}
}