# 编程之家 (jb51.cc)
//截取utf8字符串
function utf8Substr($str,$from,$len)
{
return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'.
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s','$1',$str);
}
# End 512.笔记 jb51.cc
原文链接:https://www.f2er.com/php/527869.html