PHP过滤非汉字只保留汉字
$str =A 1B 2b <中国>。XXYY字符;
/ /转换GB2312 -> UTF-8
$str = mb_convert_encoding($str,'utf-8 ','gb2312);
preg_match_all( / { x { 4e00 } - x { 9fff } } + / U,$str,$matches);
连接(,$匹配{ 0 });
/ /转换为UTF-8 -> GB2312
$str = mb_convert_encoding ($str,'GB2312','UTF-8');
回音输出
>