複製程式碼 程式碼如下:
45){$str=utf8Substr ($r[title],0,15)."...";}else{$str=$r[title];}echo $str; ?>
//截取utf8字串
function utf8Substr($str, $from, $len)
{
return preg_replace('#^(?:[x00-x7F]|[xC0-xFF][x80-xBF] ){0,'.$ from.'}'.
'((?:[x00-x7F]|[xC0-xFF][x80-xBF] ){0,'.$len.'}).*#s',
'$1',$str);
}
http://www.bkjia.com/PHPjc/313607.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313607.htmlTechArticle複製程式碼如下: ?php if(strlen($r[title])45){$str=utf8Substr ($r[title],0,15)."...";}else{$str=$r[title];}echo $str; ? //截取utf8字串function utf8Substr($str, $fr ...