/** 
 * 截取utf-8字符串 
 * @param string $str 被截取的字符串 
 * @param integer $start 起始位置 
 * @param integer $length 截取长度(每个汉字为3字节) 
 */ 
function intercept($str, $start, $length=null) {  
    preg_match_all('/./us', $str, $match);  
    $chars = is_null($length)? array_slice($match[0], $start ) : array_slice($match[0], $start, $length);  
    unset($str);
    return strip_tags(implode('', $chars));
}
转载请注明来源:http://www.dianthink.com/Article/detail/id/106.html 
点赞(2) 打赏

评论列表 共有 0 条评论

暂无评论

微信小程序

微信扫一扫体验

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部