$sqlb=$empire->query("select * from {$dbtbpre}ecms_zaoju where feilei<>'英语造句'"); while($r=$empire->fetch($sqlb)){ $input=$r['title']; $input=str_replace(',','',$input); $count=mb_strlen($input,'utf-8'); //按照utf-8字符计数 $output=''; for($i=0;$i<$count;$i++){ $cnchar=mb_substr($input,$i,1,'utf-8'); //分离出一个需要处理的字符 $output.=$cnchar.','; } $cz=rtrim($output,","); $empire->query("update {$dbtbpre}ecms_zaoju set cizu='$cz' where id='$r[id]'"); }