Current location - Quotes Website - Team slogan - How to add Chinese character data in MySQL with PHP
How to add Chinese character data in MySQL with PHP
Generally speaking, MySQL installation does not use Chinese character set by default. If you want to use Chinese data, there are two ways. One is to specify the use of Chinese characters during installation.

Generally speaking, MySQL installation does not use Chinese character set by default. There are two ways to use Chinese character data. One is to specify the use of Chinese character set when installing, and the other is to let MySQL support Chinese character data through configuration if we have installed MySQL.

If we want to use php to support Chinese character data when operating MySQL, we first need to see what kind of Chinese character set our system supports. The view method is: create a new. Php document, and then save it as, you can see the Chinese character set we support in the format. We use utf-8+BOM character set, and then the rest is how to set it. In the process of setting, MySQL _ query ("set names utf8+BOM ") should be used first. Send a command to MySQL to tell MySQL the character set we want to use, and then all php files need to be saved in utf-8+BOM format, so that you can add Chinese character data to MySQL with php, but there is a disadvantage that the Chinese character data in MySQL is garbled, but it can be read and written normally. Utf-8 is generally recommended on the Internet, but it is problematic to display it in this format. I didn't do any in-depth research, but I just put forward a plan.