/** * * html内容分页 * @param $content html内容 * @param $number 每页的字符数 */ public static function cutHtmlContent($content, $number) { $result = array(); // $content = str_replace(array('<div>','</div>'), '', $content); $totalWords = mb_strlen($content, 'utf8'); //总字数 中文3个,英文1个 if ($totalWords < 0 || $number < 0) { return $result; } $start = 0; while ($start < $totalWords) { $strl = XUtils::_checkHtmlContent($content, $start, $number); $result[] = $strl; $start += mb_strlen($strl, 'utf8'); } return $result; }