统一编码很重要 从写入 html --> php -->mysql
再读取返回时,也要注意!!
注意一:<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 在php头在 html 这个标签。 这样是html页面的要求注意二 :
header('content-Type=text/html;charset=utf-8') (不过会报warning 不好用)注意三: mysql_query("set names 'utf8'",$con); //写入时设置 mysql_query("set character set 'utf8'"); //读书时设置 注意四: iconv('GB2312', 'UTF-8', $row['XX']); //强制转换编码注意五: 数据库在创建表时要指定表的编码方式
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号