手机
当前位置:查字典教程网 >编程开发 >php教程 >PHP mb_convert_encoding文字编码的转换函数介绍
PHP mb_convert_encoding文字编码的转换函数介绍
摘要:文字编码的转换mb_convert_encoding()mb_convert_encoding($str,$encoding1,$encod...

文字编码的转换mb_convert_encoding()

mb_convert_encoding( $str, $encoding1,$encoding2 )

$str,要转换编码的字符串

$encoding1,目标编码,如utf-8,gbk,大小写均可

$encoding2,原编码,如utf-8,gbk,大小写均可

实例1

复制代码 代码如下:

<?php

$str='查字典教程网:http://www.jb51.net';

echo mb_convert_encoding($str, "UTF-8"); //编码转换为utf-8

?>

复制代码 代码如下:

<?php

$str='查字典教程网:http://www.jb51.net';

echo mb_convert_encoding($str, "UTF-8", "GBK"); //已知原编码为GBK,转换为utf-8

?>

复制代码 代码如下:

<?php

$str='查字典教程网:http://www.jb51.net';

echo mb_convert_encoding($str, "UTF-8", "auto"); //未知原编码,通过auto自动检测后,转换编码为utf-8

?>

PHP下编码转换函数mb_convert_encoding与iconv的使用说明

【PHP mb_convert_encoding文字编码的转换函数介绍】相关文章:

PHP中is_file()函数使用指南

PHP file_get_contents函数读取远程数据超时的解决方法

PHP实现将textarea的值根据回车换行拆分至数组

PHP教程:实现的将图片转换为TXT

PHP.ini安全配置检测工具pcc简单介绍

PHP文本数据库的搜索方法

PHP处理密码的几种方式

PHP ASCII码与字符串的相互转换

PHP实现的增强性mhash函数

php生成随机密码的自定义函数

精品推荐
分类导航