/**
* PHP截断字符串并保持单词完整性
*
* @param
* @arrange 512-笔记网: jb51.cc
**/
function shorten($string='',$chars=20,$elli='...'){
list($new_string,$elli)= explode("\n",wordwrap($string,$chars,"\n",false));
return ( $elli ) ? $new_string.'...' : $new_string;
}
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
原文链接:https://www.f2er.com/php/528160.html