时间:2021-07-01 10:21:17 帮助过:19人阅读
数据库中字段title这一列: 羽毛球YMQ 橄榄球GLQ 曲棍球QGQ 改成: 羽 毛 球 YMQ 橄 榄 球 GLQ 曲 棍 球 QGQ
$a='羽毛球YMQ';
$b=preg_replace('/[A-Za-z](.*)/i','',$a);
$b1=str_split($b,2);
$b2=implode(" ", $b1);
$c=preg_replace("/".$b."/",'',$a);
//echo $c;
$result=$b2." ".$c;
echo $result;
------解决方案--------------------
GBK 编码的?
mysql_select_db("new");
mysql_query("set names 'gbk'");//只要这一句
$a='羽毛球YMQ';
echo preg_replace('/[\x80-\xff]./', '$0 ', $a);