Home >Backend Development >PHP Tutorial >PHP Chinese encoding conversion mb_convert_encoding() function_PHP tutorial
Coding in PHP has always been a headache for developers, but it would be different if there were some sweet and useful functions. Let’s introduce a processing function for Chinese encoding.
mb_convert_encoding( $str, $encoding1,$encoding2 )
$str, the string to be converted to encoding
$encoding1, target encoding, such as utf-8, gbk, both upper and lower case
$encoding2, original encoding, such as utf-8, gbk, both upper and lower case
Example 1
The code is as follows
|
Copy code
|
||||||||||||||
| |||||||||||||||
$str='Movie 618:http://www.bKjia.c0m'; echo mb_convert_encoding($str, "UTF-8", "GBK"); //It is known that the original encoding is GBK, convert to utf-8 ?> Example 3
|