search
Homephp教程php手册PHP character garbled,charactergarbled

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
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

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),