Home > Article > Backend Development > PHP Chinese character encoding conversion method
# Recommended: "php Chinese character encoding conversion method: 1. Use the "string iconv()" method to convert; 2. Use the "mb_convert_encoding" method to convert; 3. Use the "mb_detect_encoding" method to convert.
PHP Video Tutorial》
1.
First parameter: content Original encoding
Second parameter: Target encoding
Third parameter: String to be converted
$filename='我爱你中国';$filename = iconv('gbk','utf-8',$filename);
Analysis: Convert $filename from gbk to utf82.
The first parameter: the string to be processed
Second parameter: target encoding
Third parameter: original encoding of content
$filename='我爱你中国';$filename = mb_convert_encoding($filename,'GBK','UTF-8');
Analysis: Convert $filename from utf8 to gbk3.
View character encoding
$filename='我爱你中国';$encode = mb_detect_encoding($filename, array("ASCII","UTF-8","GB2312","GBK","BIG5"));echo $encode;die;
The above is the detailed content of PHP Chinese character encoding conversion method. For more information, please follow other related articles on the PHP Chinese website!