<?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"; }*/ ?>
The problem is solved because my notepad development tool is of other encoding type