try {
$dsh=new PDO($dsn, $user, $password);
$dsh->query("set names utf8");
$dsh->beginTransaction();
$dsh->exec("insert into userinfo (uname,upwd,email) values ('呵呵','123','[email protected]')");

}catch(PDOException $e)
{
echo $e->getMessage();
$dsh->rollBack();

}
就是我这边不管有没有加$dsh->commit();这句话,他都会往数据库插入记录,这是为什么PDO事务数据库EmailUTF-8