mysqli::$host_info

mysqli_get_host_info

(PHP 5, PHP 7)

mysqli::$host_info -- mysqli_get_host_info锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷使锟矫碉拷锟斤拷锟斤拷锟斤拷锟酵碉拷锟街凤拷锟斤拷

说锟斤拷

锟斤拷锟斤拷锟斤拷锟斤拷锟�

锟斤拷锟教伙拷锟斤拷锟�

mysqli_get_host_info ( mysqli $link ) : string

锟斤拷锟斤拷一锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷link 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 (锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷).

锟斤拷锟斤拷

link

锟斤拷锟皆癸拷锟教伙拷锟斤拷式锟斤拷锟斤拷mysqli_connect() 锟斤拷 mysqli_init() 锟斤拷锟截碉拷锟斤拷锟接憋拷识锟斤拷

锟斤拷锟斤拷值

一锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷.

锟斤拷锟斤拷

Example #1 $mysqli->host_info example

锟斤拷锟斤拷锟斤拷锟斤拷锟�

<?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();
}

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

/* close connection */
$mysqli->close();
?>

锟斤拷锟教伙拷锟斤拷锟�

<?php
$link 
mysqli_connect("localhost""my_user""my_password""world");

/* check connection */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

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

/* close connection */
mysqli_close($link);
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

Host info: Localhost via UNIX socket

锟轿硷拷