从字符中提取出中文

 

 

//gb2312的话
preg_match_all("/[".chr(0xa1)."-".chr(0xff)."]+/", $str, $chinese);
echo implode("", $chinese[0]);

//utf-8的话
preg_match_all("/[\x{4e00}-\x{9fa5}]+/u", $str, $chinese);
posted @ 2017-01-17 17:53  王滔  阅读(424)  评论(0编辑  收藏  举报