<?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"; }*/ ?>
问题解决了,是因为我的notepad开发工具是其他编码类型