mysqli_get_proto_info,
mysqli_get_proto_info, mysqli->protocol_version — 使用している MySQL プロトコルのバージョンを返す
説明
手続き型:int mysqli_get_proto_info ( mysqli link )
オブジェクト指向型(プロパティ):
class mysqli {
string protocol_version
} link で表される接続で使用している MySQL プロトコルのバージョンを整数値で返します。
パラメータ
- link
- 手続き型のみ:
mysqli_connect() あるいは mysqli_init() が返すリンク ID。
返り値
プロトコルバージョンを整数値で返します。例
例 1412. オブジェクト指向型
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password");
/* 接続状況をチェックします */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* プロトコルのバージョンを表示します */
printf("Protocol version: %d\n", $mysqli->protocol_version);
/* 接続を閉じます */
$mysqli->close();
?>
例 1413. 手続き型
<?php
$link = mysqli_connect("localhost", "my_user", "my_password");
/* 接続状況をチェックします */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* プロトコルのバージョンを表示します */
printf("Protocol version: %d\n", mysqli_get_proto_info($link));
/* 接続を閉じます */
mysqli_close($link);
?>
上の例の出力は以下となります。
Protocol version: 10
参考
mysqli_get_host_info() |
- mysqli_get_proto_info,のページへのリンク