: This article mainly introduces how to solve php parameter garbled characters. if you are interested in the PHP Tutorial, refer to it. When the website project uses gb2312 as the project code, because different browsers may have different Chinese character codes, some may encode Chinese as the website code, and some may encode Chinese as UTF-8, garbled error occurs when parameters are received in the background. A better solution is to encode the Chinese characters in the parameters. if it is not gb2312, it will be converted.
$ TypeName = $ _ GET ['typename']; $ encode = mb_detect_encoding ($ typeName, 'cp936, UTF-8 '); // if it is CP936, it is gbk encoding, if it is a UTF-8, it is UTF-8 encoded if ($ encode = 'utf-8') {// then call the function to convert to UTF-8 encoding, make sure it is UTF-8 $ typeName = iconv ("UTF-8", "gb2312", $ typeName );}
For website coding problems and future expansion, we recommend using uft-8 coding.
The above describes how to solve php parameter garbled characters, including some content, and hope to be helpful to friends who are interested in PHP tutorials.