Home > php教程 > php手册 > body text

PHP统一页面编码避免乱码问题,php页面编码乱码

WBOY
Release: 2016-06-13 09:07:19
Original
1148 people have browsed it

PHP统一页面编码避免乱码问题,php页面编码乱码

页面编码统一

MySQL数据库编码、html页面编码、PHP或html文件本身编码要全部一致。

1、MySQL数据库编码:
建立数据库时指定编码(如gbk_chinese_ci),建立数据表、建立字段、插入数据时不要指定编码,会自动继承数据库的编码。
数据库连接时,也有编码,可以在连接完数据库后,执行mysql_query(‘SET NAMES gbk');//将gbk换成你的编码,如utf8。

2、html页面的编码,指的是这一行的设置:
复制代码 代码如下:

3銆丳HP鎴杊tml鏂囦欢鏈

Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!