您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP实现过滤掉非汉字字符只保留中文字符_PHP

2025/10/30 8:54:58发布52次查看
utf-8$str = mb_convert_encoding($str, 'utf-8', 'gb2312');preg_match_all('/[\x{4e00}-\x{9fff}]+/u', $str, $matches);$str = join('', $matches[0]);//转换 utf-8 -> gb2312$str = mb_convert_encoding($str, 'gb2312', 'utf-8'); echo $str; //输出 中文字符?>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product