When it comes to solving garbled codes in PHP and MySQL, we need to analyze the reasons for the garbled codes. The MySQL database has its own data storage encoding format, the computer has its own encoding method, and the web page has its own method. When these three are not unified When , a garbled code problem occurs...
When it comes to solving garbled codes in PHP and MySQL, we need to analyze the reasons for the garbled codes. The MySQL database has its own data storage encoding format, the computer has its own encoding method, and the web page has its own method. When these three do not When unified, garbled codes will occur. The garbled codes mentioned here mainly refer to incorrect Chinese display. Under normal circumstances, if we want to display Chinese, we should select utf-8 as the encoding method of the web page, and utf8_unicode_ci as the database encoding method. At the same time, we should pay attention to when inserting data into the database, we must first execute mysql_query("set names utf8"); so that the database can correctly store Chinese. |