array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'it', ), 'this' => array ( 0 => 'mysqli.get-host-info.php', 1 => 'mysqli::$host_info', 2 => 'Returns a string representing the type of connection used', ), 'up' => array ( 0 => 'class.mysqli.php', 1 => 'mysqli', ), 'prev' => array ( 0 => 'mysqli.get-connection-stats.php', 1 => 'mysqli::get_connection_stats', ), 'next' => array ( 0 => 'mysqli.get-proto-info.php', 1 => 'mysqli::$protocol_version', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mysqli/mysqli/get-host-info.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 5, PHP 7, PHP 8)
mysqli::$host_info -- mysqli_get_host_info — Returns a string representing the type of connection used
Stile orientato agli oggetti
Stile procedurale
Returns a string describing the connection represented by
the mysql
parameter (including
the server host name).
link
Solo nello stile procedurale: un identificatore restituito da mysqli_connect() o mysqli_init()
A character string representing the server hostname and the connection type.
Example #1 $mysqli->host_info example
Stile orientato agli oggetti
<?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);
Stile procedurale
<?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));
I precedenti esempi visualizzeranno:
Host info: Localhost via UNIX socket