mysqli_get_host_info
(PHP 5)
mysqli_get_host_info
(no version information, might be only in CVS)
mysqli->get_host_info -- Retorna uma string representando o tipo da conexão usada
Descrição
Estilo de procedimento:
string
mysqli_get_host_info ( object link )
Estilo orientado a objeto (propriedade):
class
mysqli {
string host_info
}
A função mysqli_get_host_info() retorna uma string
descrevendo a conexão representada pelo parâmetro link
que esta sendo usada (incluindo o nome do servidor).
Valores Retornados
Uma string de caracteres representando o nome do servidor e o tipo de conexão.
Exemplo
Exemplo 1. Estilo orientado a objeto
<?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(); ?>
|
|
Exemplo 2. Estilo de procedimento
<?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); ?>
|
|
Os exemplos acima irão produzir a seguinte saída:
Host info: Localhost via UNIX socket |