// 计算中文字符串长度
function utf8_strlen($string = null) {
// 将字符串分解为单元
preg_match_all("/./us", $string, $match);
// 返回单元个数
return count($match[0]);
}
$len = utf8_strlen($keywords);
if($len>0){
for($i=0;$i<$len;$i++){
for($j=$len;$j>0;$j--){
if($i<$j){
function utf8_strlen($string = null) {
// 将字符串分解为单元
preg_match_all("/./us", $string, $match);
// 返回单元个数
return count($match[0]);
}
$len = utf8_strlen($keywords);
if($len>0){
for($i=0;$i<$len;$i++){
for($j=$len;$j>0;$j--){
if($i<$j){
$keyword = mb_substr($keywords, $i, $j-$i, 'utf-8');
}
}
}
}