Home  >  Article  >  Backend Development  >  php读取mysql中文汉字出现乱码

php读取mysql中文汉字出现乱码

WBOY
WBOYOriginal
2016-06-23 14:16:55855browse


    header("Content-Type: text/html; charset=UTF-8");
?>



无标题文档


$conn=@mysql_connect("localhost","root","") or die("数据库连接失败!");
mysql_select_db("student_sys",$conn);
mysql_query("set names utf-8");
$query=mysql_query("select * from user_login");
$row=mysql_fetch_array($query);
echo $row['admin_loginname'];
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn