#./configure --with-mysqli=/opt/MySQL5/bin/mysql_config --enable-xslt --with-xslt-sablot --with-apxs=/opt/apache/bin/apxs --with-gd --with-zlib --with-pgsql=/opt/pgsql
mysqli() 同时提供 面向对象 与 面向过程 的两种链接方式
< ?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", $mysqli->host_info);
/* close connection */
$mysqli->close();
?>
< ?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (!$link) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", mysqli_get_host_info($link));
/* close connection */
mysqli_close($link);
?>
No comments:
Post a Comment