标签:div user 连接服务器 pre 面向过程 word 过程 password code
mysqli 面向对象连接
$host = ‘localhost‘; $user = ‘root‘; $password = ‘root‘; // 创建连接 $conn = @new mysqli($host, $user, $password); // 检测连接 if ($conn->connect_error) { die("连接失败: " . $conn->connect_error); }else{ echo "连接成功"; }
mysqli 面向过程连接
$host = ‘localhost‘; $user = ‘root‘; $password = ‘root22‘; //创建连接 $conn = @mysqli_connect($host,$user,$password); if($conn) { echo ‘连接服务器成功‘; }else { echo ‘连接服务器失败‘.mysqli_error(); }
标签:div user 连接服务器 pre 面向过程 word 过程 password code
原文地址:http://www.cnblogs.com/lubenxin/p/7105936.html