好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php汉字编码转换的方法

二、 mb_convert_encoding

string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding ] )
第一个参数:要处理的字符串
第二个参数:目标编码
第三个参数:内容原编码

$filename='我爱你中国';$filename = mb_convert_encoding($filename,'GBK','UTF-8');

解析:把$filename从utf8转换为gbk

三、 mb_detect_encoding 查看字符编码

$filename='我爱你中国';$encode = mb_detect_encoding($filename, array("ASCII","UTF-8","GB2312","GBK","BIG5"));echo $encode;die;

以上就是php汉字编码转换的方法的详细内容!

查看更多关于php汉字编码转换的方法的详细内容...

  阅读:39次