search

Home  >  Q&A  >  body text

How to modify PHP Chinese characters to display garbled characters on the web page

<?php
header("content-type:text/html;charset=utf-8");
$host = 'localhost';
$username = 'root';
$password = 'root';
$dbname = 'student_info';
//$db = new mysqli($host,$username,$password,$dbname);
$db = mysqli_connect($host,$username,$password,$dbname);
mysqli_set_charset($db,'utf8_encode');
if($db){
	//echo "MySql connection successful";
	echo "MySql连接成功!";
}
/*
$link = mysqli_connect($host,$username,$password);
mysqli_select_db($link, $dbname);
if($link){
	echo "MySql connection successful";
}*/
?>


永恒之蓝永恒之蓝2075 days ago802

reply all(1)I'll reply

  • 永恒之蓝

    永恒之蓝2019-04-25 10:50:48

    The problem is solved because my notepad development tool is of other encoding type

    reply
    0
  • Cancelreply