CakeFest 2024: The Official CakePHP Conference

mysqli::$host_info

mysqli_get_host_info

(PHP 5, PHP 7, PHP 8)

mysqli::$host_info -- mysqli_get_host_infoRetorna uma string representando o tipo de conexão utilizada

Descrição

Estilo orientado a objetos

Estilo procedural

mysqli_get_host_info(mysqli $mysql): string

Retorna uma string descrevendo a conexão representada pelo parâmetro mysql (incluindo o nome de host servidor).

Parâmetros

mysql

Somente no estilo procedural: Um objeto mysqli retornado por mysqli_connect() ou mysqli_init()

Valor Retornado

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

Exemplos

Exemplo #1 Exemplo de $mysqli->host_info

Estilo orientado a objetos

<?php

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

/* mostra informação do host */
printf("Host info: %s\n", $mysqli->host_info);

Estilo procedural

<?php

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

/* mostra informação do host */
printf("Host info: %s\n", mysqli_get_host_info($link));

Os exemplos acima produzirão:

Host info: Localhost via UNIX socket

Veja Também

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top