php 新版 mysqli 的数据库连接方式
define("HOST","localhost"); define("USER","root"); define("PASS",""); define("NAME","php"); $mysqli = new MySQLi(HOST,USER,PASS,NAME);//实例化一个mysqli 对象 if(mysqli_connect_errno()){ echo "连接失败:".mysqli_connect_errno(); exit; } $mysqli->query('set names utf8');//设置字符集
页:
[1]