您现在的位置是:网站首页>PHPPHP
PHP检测当前字符串编码并转码UTF-8
左鹏03-06 10:27:56【PHP】4,032人已围观
简介1、获取当前字符串编码 $encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK")); 2、将字符串编码转为UTF-8 $str = mb_convert_encoding($str, 'UTF-8', $encode);
1、获取当前字符串编码
$encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK"));
2、将字符串编码转为UTF-8
$str = mb_convert_encoding($str, 'UTF-8', $encode);
点击排行
本栏推荐
猜你喜欢
站点信息
- 建站时间:2018-09-18
- 网站程序:Spring Boot
- 主题模板:《今夕何夕》
- 文章统计:104条
- 微信公众号:扫描二维码,关注我们