When making a web page by yourself, you often encounter the problem of garbled web pages.
In fact, there are several main reasons for garbled web pages, and the solutions are given below. 1. HTML character encoding problem This problem is the most common, the most obvious, and the easiest to solve. In the of the page, add: That’s it. 2. PHP character encoding problem This is similar to above. Above the file add: header("Content-type:text/html;charset=utf8"); that's it. 3. Encoding problem of the file itself Not only is our content encoded, but so is the file itself. Use Notepad++ to open a file and you can see the content displayed in the lower right corner. It's the encoding of the file itself. You can use "Format" on the Notepad++ toolbar to convert the encoding for our files. 4. Database encoding issue MySQL data is latin1 encoded when installed by default, so it is likely to cause garbled web pages without paying attention. Use root to enter the database, Enter show variables like 'character%' can be seen character_set_client character_set_connection