Latest web development tutorials

PHP mysqli_get_host_info () function

PHP MySQLi Reference Manual PHP MySQLi Reference Manual

Examples

Returns the MySQL server host name and the connection type:

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检测连接
if (mysqli_connect_errno($con))
{
     echo "数据库连接失败: " . mysqli_connect_error();
}

echo mysqli_get_host_info($con);

mysqli_close($con);
?>

Definition and Usage

mysqli_get_host_info () function returns the MySQL server host name and connection type.


grammar

mysqli_get_host_info( connection ) ;

参数 描述
connection 必需。规定要使用的 MySQL 连接。

technical details

return value: Returns a MySQL server host name and connection type of string.
PHP version: 5+


PHP MySQLi Reference Manual PHP MySQLi Reference Manual