Summary of the garbled code problem in zend studio_PHP tutorial

WBOY
Release: 2016-07-21 15:03:48
Original
757 people have browsed it

There are about 4 places where garbled characters appear:

1. The encoding method of the file (that is, the encoding of your new file), this requires setting the editor encoding method.

2. The page does not specify the browser encoding display method. The solution is:
1. If the page is .html, you need to set ,
2 If it is an x.php file, you need to add header ("content-type: text/html; charset=utf-8") at the head. In total What it means is to tell the browser that I want utf-8 encoding to display the page.

3. Specify the encoding of the database when creating a new database, and add mysql_query("set names utf8") when linking to the database; specify that the information encoding output by the database is utf-8.

4. When using ajax, you need to specify the encoding of the received data on the receiving page. Use the function iconv().

In short: all encodings are unified. No matter the encoding is utf-8 or gbk, etc.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327828.htmlTechArticleThere are about 4 places where garbled characters appear: 1. The encoding method of the file (that is, the encoding of your new file) , this requires setting the encoding method of the editor. 2. The page does not specify a browser...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template