Table of Contents
PHP character garbled,charactergarbled
Home php教程 php手册 PHP character garbled,charactergarbled

PHP character garbled,charactergarbled

Jun 13, 2016 am 09:07 AM
iconv

PHP character garbled,charactergarbled

MySql  控制台查询时出现乱码  

Database&Table 的字符集 于Mysql控制台显示的字符集不一样  

右键单击mysql控制台边框  单击属性  查看当前代码页的字符集模式是否于数据库的字符集模式一样

查看数据库字符集 show variables like '%char%';  

主要看的有:character-set-client=gbk     character-set-server=gbk    character-set-result=gbk  是否一样

解决:设置数据库字符模式

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  字符校对模式       gbk没找到校对,有请留言。

没效果请打开my.ini  修改 default-character-set=gbk    character-set-server=gbk

创建的时候指定:

create  database Database_name character set gbk;

 

页面乱码:在Dreamware 上找到页面属性  设置字符模式

如果有链接Mysql  应该保持统一

数据库+页面字符集+HTML head+Mysql于PHP链接字符(set names gbk)

在页面查询数据库获取的是乱码:Mysql ,页面字符集,mysql和PHP传输字符是否一样

设置apache的配置文件 httpd.conf  添加或修改apache 默认字符启动模式: AddDefaultchars gbk

直接设置传输字符 mysql> set names gbk  

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

    mysql_close();  

?>

 

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)