我在网上找了好多方法
诸如:mysql_query("set names 'gbk'") mysql_query("set names utf8") 修改php.ini配置文件等等 都没用额我的数据库是utf-8的所有文件也是utf-8的能正常入库,就是里面的中文全成乱码了望高人指点,谢谢
诸如:mysql_query("set names 'gbk'") mysql_query("set names utf8") 修改php.ini配置文件等等 都没用额我的数据库是utf-8的所有文件也是utf-8的能正常入库,就是里面的中文全成乱码了望高人指点,谢谢
我用phpmyadmin进入数据库浏览看的额
代码如下:<?php
include("conn.php");
header('Content-Type: text/html; charset=UTF-8');
$man=$_POST["man"];
$tel=$_POST["tel"];
$add=$_POST["add"];
$fax=$_POST["fax"];
$content=$_POST["content"];
$datex=date("Y/m/d");
if (strlen($man)<=0 ){
echo "<script>alert('请输入您的大名');history.go(-1)</script>";
exit;
}
if (strlen($tel)<=0){
echo "<script>alert('请输入您的联系方式');history.go(-1)</script>";
exit;
}
if (strlen($content)<=0){
echo "<script>alert('请输入留言内容');history.go(-1)</script>";
exit;
}
if (strlen($content)<=10){
echo "<script>alert('您输入的留言内容过短,最少十个字。');history.go(-1)</script>";
exit;
}
if (strlen($content)>=300){
echo "<script>alert('您输入的留言内容长,最多300字。');history.go(-1)</script>";
exit;
}
mysql_select_db("hellodate",$con);
$sql="INSERT INTO message
VALUES ('','$man','$tel','$add','$fax','$datex','$content')";
if(!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
mysql_close($con);
exit;
}
else{
mysql_close($con);
echo "<script>alert('恭喜您,留言成功');location.href='index.php'</script>";
exit;
}
?>
这我怎么查额 显示的字符集是utf-8 哦文件我查过了 是utf8额
但并不保证之前的数据也是 utf-8 编码的
那段代码中我加入了 mysql_query("set names utf8") 提交之后还是乱码额
那段代码中我加入了mysql_query("set names utf8");
数据库的编码是utf8 unicode ci
数据表也是 utf8 unicode ci可是还是乱码额