$sub= '我有5斤大米,6斤白面,售卖100元';
我想提取"有5斤大米"、"卖100元",用preg_match_all( '/.?\d+.?/', $sub, $match)出现乱码
改成preg_match_all( '/.?\d+.?/u', $sub, $match)后正常。
这里的小写字母u是修饰符,表示把字符当utf-8处理。
官方文档:https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
2022-10-08技术教程下载本文preg_match,中文,乱码,探索,提取
$sub= '我有5斤大米,6斤白面,售卖100元';
我想提取"有5斤大米"、"卖100元",用preg_match_all( '/.?\d+.?/', $sub, $match)出现乱码
改成preg_match_all( '/.?\d+.?/u', $sub, $match)后正常。
这里的小写字母u是修饰符,表示把字符当utf-8处理。
官方文档:https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
《preg_match提取中文的乱码问题探索.doc》
下载本文的Word格式文档,以方便收藏与打印。
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”. 翻译:SpringBoot可以很简单的创建一个基于项目的单机版,生产环境水平的Spring框架,...
2024-03-14编程代码springboot,中文,介绍