Home > php教程 > php手册 > php函数mb_detect_encoding自动识别编码并自动转换成utf8的方法

php函数mb_detect_encoding自动识别编码并自动转换成utf8的方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:11:01
Original
1223 people have browsed it

php中有一个自动识别编码的函数mb_detect_encoding(),下面的代码是探测文章编码并自动转换成utf8的方法 //自动识别编码并自动转换成utf8 /* 爱推吧 http://ituibar.com */ function characet($data){ if(!empty($data)){ $fileType=mb_detect_encoding($date

php中有一个自动识别编码的函数mb_detect_encoding(),下面的代码是探测文章编码并自动转换成utf8的方法

//自动识别编码并自动转换成utf8
 /*
 爱推吧 http://ituibar.com
 */
 function characet($data){
 if(!empty($data)){
 $fileType=mb_detect_encoding($date,array('utf-8','GBK','LATIN1','BIG5'));
 if($fileType !='utf-8'){
 $data=mb_convert_encoding($data, 'utf-8',$fileType) ;
 }
 }
 return $date;
 }
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template