PHP cannot process strings to process data, but we must make the database encoding consistent with that of the webpage or application. Otherwise, garbled characters may occur. Therefore, before data storage or updating-when calling the data storage process, we must unify the data encoding. And a lot of web pages are based on UTF-8 encoding, we
PHP cannot process strings to process data, but we must make the database encoding consistent with that of the webpage or application. Otherwise, garbled characters may occur. Therefore, before data storage or updating-when calling the data storage process, we must unify the data encoding. And a lot of web pages are based on UTF-8 encoding, we
PHP cannot process strings to process data, but we must make the database encoding consistent with that of the webpage or application. Otherwise, garbled characters may occur. Therefore, before data storage or updating-when calling the data storage process, we must unify the data encoding. And a lot of web pages are based on UTF-8 encoding, we now look at, before the data storage, we should do how to achieve the conversion of encoding. Here, we take the conversion string encoding into the UTF-8 as an example to see how to deal with it.
Function
??
Here, two important functions are used. One is the mb_detect_encoding function used to obtain the encoding. PHP Tutorial: Use mb_detect_encoding to obtain the encoding of a string. Use the mb_check_encoding function to check the encoding. It is worth noting that when we store or update data, we must use the addslashes () function to process the output results !!
Statement: This article uses BY-NC-SA protocol for authorization | IT passers-
Reprinted please note