我也在精华区看到了把代码再贴下:):
$j=0;
$num=10;
for($i=0;$i<$num;$i++)
  if(ord(substr($string,$i,1))>0xa0) $j++;
if($j%2!=0) $num++;
$str=substr($string,0,$num);