欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php mb_convert_encoding文字编码转换函数

程序员文章站 2022-04-18 08:16:36
...
  1. $str='脚本学堂:http://bbs.it-home.org';

  2. echo mb_convert_encoding($str, "utf-8"); //编码转换为utf-8
  3. $str='程序员之家:http://bbs.it-home.org';

  4. echo mb_convert_encoding($str, "utf-8", "gbk"); //已知原编码为gbk,转换为utf-8
  5. $str='程序员之家:http://bbs.it-home.org';

  6. echo mb_convert_encoding($str, "utf-8", "auto"); //未知原编码,通过auto自动检测后,转换编码为utf-8
  7. ?>
复制代码