Solve the garbled problem for PHP beginners _ PHP Tutorial

Source: Internet
Author: User
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. (

Authorization 1. HTML page encoding: meta http-equiv = content-type content = t...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.