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

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

WBOY
Release: 2016-06-23 14:16:55
Original
887 people have browsed it


    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'];
?>

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template