WordPress中文截取函数用法分析

前端之家收集整理的这篇文章主要介绍了WordPress中文截取函数用法分析前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文实例讲述了wordpress中文截取函数用法分享给大家供大家参考。具体分析如下:

很多朋友直接使用PHP substr函数截取中文是会出现乱码,下面我先来给各位总结中文字符截取函数,然后以wordpress截取中文标题为例给大家介绍实例应用.

中文截取函数,代码如下:

=0; $i-=1){ $hex .= ' '.ord($str[$i]); $ch = ord($str[$i]); if (($ch & 128)==0) return(substr($str,$i)); if (($ch & 192)==192) return(substr($str,$i)); } return($str.$hex); } function mul_excerpt ($excerpt,$excerpt_length) { $myexcerpt = substr($excerpt,$excerpt_length); return utf8_trim($myexcerpt) . '… '; } 原文链接:https://www.f2er.com/wordpress/15202.html

猜你在找的wordpress相关文章