mysqli_get_metadata> <mysqli_get_client_version
Last updated: Mon, 28 Dec 2009

mysqli_get_host_info

mysqli->get_host_info

(PHP 5)

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):

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).

Valor Retornado

Uma string de caracteres representando o nome do servidor e o tipo de conexão.

Exemplo

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

Example#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


User Contributed Notes
mysqli_get_host_info
pierre at pierrepaquette dot net
04-Aug-2007 12:33
Why would it be that when I try object-oriented style, viz:
$a->host_info;
I get the following error message:
Undefined property: mysqli::$host_info
in PHP 6
whereas if I try the procedural style, viz:
mysqli_get_host_info($a);
there is no error.

I have similar error messages with quite a few functions in PHP 6, actually. Did the object-oriented way to call them change?

Pierre

mysqli_get_metadata> <mysqli_get_client_version
Last updated: Mon, 28 Dec 2009