跳转到主要内容

get-host-info

mysqli::$host_info

mysqli_get_host_info

Returns a string representing the type of connection used

ENTITY

ENTITY

string

mysqli-ENTITYhost_info

ENTITY

string

mysqli_get_host_info

mysqli

mysql

Returns a string describing the connection represented by the mysql parameter (including the server host name).

ENTITY

ENTITY

A character string representing the server hostname and the connection type.

ENTITY

$mysqli-ENTITYhost_info example

ENTITY

<?php

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

/* print host information */
printf("Host info: %s\n", $mysqli->host_info);

   

ENTITY

<?php

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "world");

/* print host information */
printf("Host info: %s\n", mysqli_get_host_info($link));

   

ENTITY

Host info: Localhost via UNIX socket

ENTITY

mysqli_get_proto_info