如题,我的mysql的字符集都是设置成utf8的,php文件也是以utf-8保存的,但是当通过php页面插入到mysql的中文字符在数据库中查看时就是乱码的,怎么回事啊
如题,我的mysql的字符集都是设置成utf8的,php文件也是以utf-8保存的,但是当通过php页面插入到mysql的中文字符在数据库中查看时就是乱码的,怎么回事啊
Test1
介绍
年龄
名字
--------------------------------------------------------------------------------------------
@header("content-Type: text/html; charset=utf-8");
try{
$pdo=new PDO("mysql:host=localhost;dbname=aiku","root","a");
$stmt=$pdo->prepare("insert into aibiao(age,name,introduction) value(?,?,?)");
$stmt->bindparam(1,$age);
$stmt->bindparam(2,$name);
$stmt->bindparam(3,$introduction);
$age=$_GET["age"];
$name="{$_GET['name']}";
$introduction=$_GET['intro'];
$stmt->execute();
}catch(PDOException $e)
{
echo $e->getmassage();
}
?>我是以UTF-8格式编码的!
展开