downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mysqli->protocol_version> <mysqli::get_connection_stats
Last updated: Fri, 13 Nov 2009

view this page in

mysqli->host_info

mysqli_get_host_info

(PHP 5)

mysqli->host_info -- mysqli_get_host_info使用している接続の型を文字列で返す

説明

オブジェクト指向型(プロパティ):

string $host_info;

手続き型:

string mysqli_get_host_info ( mysqli $link )

link が使用している接続の情報を文字列で返します(サーバのホスト名を 含みます)。

パラメータ

link

手続き型のみ: mysqli_connect() あるいは mysqli_init() が返すリンク ID。

返り値

サーバのホスト名と接続の型を文字列で返します。

例1 オブジェクト指向型

<?php
$mysqli 
= new mysqli("localhost""my_user""my_password""world");

/* 接続状況をチェックします */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

/* ホスト情報を表示します */
printf("Host info: %s\n"$mysqli->host_info);

/* 接続を閉じます */
$mysqli->close();
?>

例2 手続き型

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

/* 接続状況をチェックします */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

/* ホスト情報を表示します */
printf("Host info: %s\n"mysqli_get_host_info($link));

/* 接続を閉じます */
mysqli_close($link);
?>

上の例の出力は以下となります。

Host info: Localhost via UNIX socket

参考



add a note add a note User Contributed Notes
mysqli->host_info
There are no user contributed notes for this page.

mysqli->protocol_version> <mysqli::get_connection_stats
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites