php获取mysql中文后显示乱码,能帮修改一下吗
<?php<br />header("Content-type: text/html; charset=utf-8");<br />$dsn = 'mysql:host=localhost;dbname=pw9';<br />$db = new PDO($dsn,'root','');<br />$rs = $db->query('SELECT * FROM pw_bbs_threads');<br />while($row=$rs->fetch()){<br /> print_r($row);<br />}
1.文件编码utf8
2.mysql编码utf8
3.浏览器编码utf8
搜索了很多,发现有人说要set names utf8,可是在我这个代码里面不知道如何写,麻烦高人修改一下谢谢