PHP mysqli_get_host_info()Function

PHP MySQLi 参考手册PHP MySQLi Reference Manual

Examples

Returns the MySQL server hostname and connection type:

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Database connection failed: " . mysqli_connect_error();
}

echo mysqli_get_host_info($con);

mysqli_close($con);
?>

Definition and Usage

The mysqli_get_host_info() function returns the MySQL server hostname and connection type.


Syntax

mysqli_get_host_info(connection);

Parameters Description
connection Required. Specifies the MySQL connection to use.

Technical Details

Return value: Returns a string representing the MySQL server hostname and connection type.
PHP Version: 5+


PHP MySQLi 参考手册PHP MySQLi Reference Manual Other Extensions