Home >Backend Development >PHP Tutorial >PHP character garbled,charactergarbled_PHP教程

PHP character garbled,charactergarbled_PHP教程

WBOY
WBOYOriginal
2016-07-13 09:57:531071browse

PHP character garbled, charactergarbled

Garbled characters appear during MySql console query

The character set of Database&Table is different from the character set displayed on the Mysql console

Right-click the mysql console border and click Properties to check whether the character set mode of the current code page is the same as the character set mode of the database

View database character set show variables like '%char%';

The main things to look at are: character-set-client=gbk character-set-server=gbk character-set-result=gbk Is it the same

Solution: Set database character mode

alert database Database_name default character set gbk;

alert database Database_name default character set utf8 default collate utf8_geberal_ci;

collate utf8_geberal_ci: utf8 character collation mode gbk did not find the collation, please leave a message.

If it doesn’t work, please open my.ini and modify default-character-set=gbk character-set-server=gbk

Specify when creating:

create database Database_name character set gbk;

The page is garbled: Find the page properties on Dreamware and set the character mode

If there is a link to Mysql, it should be unified

Database page character set HTML head Mysql to PHP link character (set names gbk)

What I get when querying the database on the page is garbled characters: Mysql, page character set, are mysql and PHP transmission characters the same

Set apache configuration file httpd.conf Add or modify apache default character startup mode: AddDefaultchars gbk

Set the transmission characters directly mysql> set names gbk

 mysql_query("set names gbk",$conn);

mysql_close();

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/980030.htmlTechArticlePHP character garbled, charactergarbled Garbled characters appear when querying on the MySql console. The character set of the DatabaseTable is displayed on the Mysql console. Not the same right click on the mysql console border...
Statement:
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