天天看點

怎麼看MySQL是否中文亂碼_mysql資料庫檢視中文顯示亂碼

如題,我的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格式編碼的!

展開