All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
PHP的内码转换函数,mb_convert_encoding

Writer: aaa Article type: Programming skills(编程技巧) Time: 2013/12/21 22:26:10 Browse times: 380 Comment times: 0

PHP的内码转换函数,mb_convert_encoding()_php资料_编程技术


Head photo

Go homepage
Upload pictures
Write articles

PHP的内码转换函数 mb_convert_encoding()_php资料_编程技术-你的首页-uuhomepage.com

因为某程序要用输出UTF-8编码..但是原数据是GBK编码的

百度 找了很多有关内码转换的类..但是缺点很多.又不支持GBK TO UTF-8

不过一个一个找还是在PHP官方的FAQ找到了mb_convert_encoding() 该函数要在PHP4.0.6以上才有..听说有的
想关链接: http://cn.php.net/manual/zh/function.mb-convert-encoding.php

做一个GBK To UTF-8
< ?php
header("content-Type: text/html; charset=Utf-8");
echo mb_convert_encoding("妳係我的友仔", "UTF-8", "GBK");
?>

再来个GB2312 To Big5
< ?php
header("content-Type: text/html; charset=big5");
echo mb_convert_encoding("你是我的朋友", "big5", "GB2312");
?>






There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.