Home > Backend Development > PHP Tutorial > php 乱码问题

php 乱码问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:30:21
Original
1218 people have browsed it

统一编码很重要 从写入 html --> php -->mysql

再读取返回时,也要注意!!

注意一:<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  在php头在 html 这个标签。  这样是html页面的要求注意二 :
Copy after login
header('content-Type=text/html;charset=utf-8')  (不过会报warning 不好用)
Copy after login
注意三: mysql_query("set names 'utf8'",$con); //写入时设置 mysql_query("set character set 'utf8'"); //读书时设置  注意四: iconv('GB2312', 'UTF-8', $row['XX']); //强制转换编码
Copy after login
注意五: 数据库在创建表时要指定表的编码方式 
Copy after login
Copy after login

Related labels:
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