1 $str1="是你"; 2 $strA = trim($str1); 3 $lenA = strlen($strA); 4 $lenB = mb_strlen($strA,"utf-8"); 5 if($lenA===$lenB){ 6 echo "英文"; 7 }else{ 8 if($lenA % $lenB == 0){ 9 echo "中文"; 10 }else{11 echo "中英";12 }13 }
本文共 403 字,大约阅读时间需要 1 分钟。
1 $str1="是你"; 2 $strA = trim($str1); 3 $lenA = strlen($strA); 4 $lenB = mb_strlen($strA,"utf-8"); 5 if($lenA===$lenB){ 6 echo "英文"; 7 }else{ 8 if($lenA % $lenB == 0){ 9 echo "中文"; 10 }else{11 echo "中英";12 }13 }
转载地址:http://nrdix.baihongyu.com/