Here is actually the most basic, is to judge the length and intercept the corresponding length of the content, and splicing; The most rudimentary logical string intercepts and displays ellipses beyond

/** * string truncated and displayed ellipsis *@param* $text content@paramThe length of the $length *@return array
 */
function subtext($text.$length)
{
	if(mb_strlen($text.'utf8') > $length)
	return mb_substr($text.0.$length.'utf8').'... ';
	else{
		return $text; }}Copy the code