截取内容清除html之后的字符串长度,支持中文和其他编码
function html_msubstr($str, $start=0, $length, $suffix=false, $charset="utf-8") { $str = wd_htmlspecialchars_decode($str); $str = checkStrHtml($str); return msubstr($str, $start, $length, $suffix, $charset); }
function wd_htmlspecialchars_decode($str) { if (is_string($str) && stripos($str, '<') !== false && stripos($str, '>') !== false) { $str = htmlspecialchars_decode($str); } return $str; }
本文为看恩吧原创文章,转载无需和我联系,但请注明来自knsay.com