The solution to the Chinese garbled code in gbk encoding under php: first check the web page encoding, the code is [document.characterSet]; then convert the encoding from gbk to [utf-8], the code is [$contents=mb_convert_encoding(( $content】.
##Solution to Chinese garbled code in gbk encoding under php:
1. Check the web page encodingOpen the browser console to view the encodingdocument.characterSet
$结果字符串 = mb_convert_encoding($原字符串, "目标便编码","原编码"); $contents = mb_convert_encoding($contents, "utf-8","gbk");
Related learning recommendations:php programming(video)
The above is the detailed content of What to do if gbk encodes Chinese garbled characters under php. For more information, please follow other related articles on the PHP Chinese website!