Heim > Artikel > Backend-Entwicklung > php获取mysql汉语言后显示乱码,能帮修改一下吗
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 /> }