详细信息 您现在的位置是:首页 > php
常用编码转换utf8、gbk等互相转换
来源:
发布时间:2021-06-05
588 人已围观
摘要由于文件、数据编码问题,使网站出现乱码问题经常遇到。几个实用小操作分享下
由于文件、数据编码问题,使网站出现乱码问题经常遇到。几个实用小操作分享下
mb_convert_encoding ( string str, string to_encoding [, mixed from_encoding] )
1、把 GBK 编码字串转换成 UTF-8 编码字串
header("content-Type: text/html; charset=Utf-8");
echo mb_convert_encoding("你好", "UTF-8", "GBK");
die;
2、把 UTF-8 编码字串转换成 GB2312 编码字串
header("content-Type: text/html; charset=big5");
echo mb_convert_encoding("你是我的朋友", "big5", "GB2312");
die;
3、//判断字符是什么编码
mb_detect_encoding($customer['CustomerName'], array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
下一篇: php生成xml文件
站点信息
- 电话:15226178738
- QQ:1697915848
- 邮箱:1697915848@qq.com