php intercepts the first 20 characters of a piece of text

$tmp = strip_tags($model->content);
$temLen = mb_strlen($tmp);
return mb_substr($tmp,0,20,'utf-8').(($temLen>20)?'...':"");

Guess you like

Origin www.cnblogs.com/gaogaoxingxing/p/12743499.html