PHP 用 mb_strimwidth() 截取文章摘要

按字符宽度获取

mb_strimwidth ( string $str , int $start , int $width [, string $trimmarker [, string $encoding ]] )

参数说明:

$str //指定字符串

$start //指定从何处开始截取

$width //截取文字的宽度

$trimmarker //超过$width数字后显示的字符串

$encoding //设置字符编码

使用例子

mb_strimwidth( strip_tags( $content ),0,240,'...','UTF-8');

原文地址:https://www.cnblogs.com/lzs-888/p/6101316.html