PHP website Program garbled Problem Solving method

Source: Internet
Author: User

Garbled is a very big problem for beginners of PHP, now summed up the cause of garbled and solution:

HTML page encoding:meta Http-equiv=content-type content=text/html; Charset=utf-8 coding here and database coding, and connecting the database coding;

Second, the file in the storage code: such as file inde.php, change its storage code for the required encoding. Simply save it as a editplus text editing software file, select the correct encoding in the code (which many people will ignore);

third, the database code: For example, with the phpMyAdmin Select the database, select the action option. Here is a collation, which should also be set into a unified code;

Four, table code: operation and 3rd similar. There is no repetition here;

Five, Field coding: in the construction of the table in the field, there is a collation. If the content has Chinese characters, it must be changed into a unified code;

mysql_select_db () After the connection to the database (), add a sentence mysql_query (set names UTF8);

Seven, (just encountered) local test after the successful website, uploaded to the Internet, there will be garbled. It is possible to export the data locally without selecting the correct encoding, so there is a garbled problem after importing to the Web.

In fact, as long as the careful point, you can completely solve the problem of PHP garbled, difficult is not technology, but careful.



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: info-contact@alibabacloud.com 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.