Solve the garbled problem for PHP beginners. Garbled text has always been a major problem for PHP beginners. the reasons for garbled text and solutions are summarized as follows: 1. HTML page encoding: metahttp-equivcontent-typecontentt garbled characters have always been a major problem for PHP beginners. the reasons for the garbled text and solutions are as follows:
I. HTML page encoding: meta http-equiv = content-type content = text/html; charset = utf-8 the encoding here must be in the database encoding and connection database encoding;
2. file storage encoding: for example, the storage encoding of an inde. php file is changed to the required encoding. You only need to use EditPlus and other texts to edit software files and save them as files. select the correct encoding in the encoding (this will be ignored by many people );
III. database encoding: for example, if phpmyadmin is used to select a database, select the Operation option. There is an arrangement below, which should also be set to a unified encoding;
4. table encoding: The operation is similar to the third point. We will not repeat it here;
5. Field Encoding: organize the fields created during table creation. If the content contains Chinese characters, it must be changed to a unified encoding;
6. after mysql_select_db () is connected to the database, add mysql_query (set names utf8 );
7. after the local test is successful, the website will be uploaded to the Internet with garbled characters. It may be because the correct encoding is not selected when exporting data locally, so it will cause garbled characters after being imported to the web.
In fact, as long as you are careful, you will be able to completely solve the php garbled problem. The difficulty is not technical, but careful. (Www.bkjia.com)
Authorization 1. HTML page encoding: meta http-equiv = content-type content = t...