mysqli::$protocol_version

mysqli_get_proto_info

(PHP 5, PHP 7)

mysqli::$protocol_version -- mysqli_get_proto_info锟斤拷锟斤拷MySQL使锟矫碉拷协锟斤拷姹撅拷锟�

说锟斤拷

锟斤拷锟斤拷锟斤拷锟斤拷锟�

锟斤拷锟教伙拷锟斤拷锟�

mysqli_get_proto_info ( mysqli $link ) : int

锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 锟斤拷link锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 锟斤拷使锟矫碉拷MySQL协锟斤拷陌姹撅拷锟�.

锟斤拷锟斤拷

link

锟斤拷锟皆癸拷锟教伙拷锟斤拷式锟斤拷锟斤拷mysqli_connect() 锟斤拷 mysqli_init() 锟斤拷锟截碉拷锟斤拷锟接憋拷识锟斤拷

锟斤拷锟斤拷值

锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷协锟斤拷陌姹撅拷锟�.

锟斤拷锟斤拷

Example #1 $mysqli->protocol_version example

锟斤拷锟斤拷锟斤拷锟斤拷锟�

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

/* check connection */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

/* print protocol version */
printf("Protocol version: %d\n"$mysqli->protocol_version);

/* close connection */
$mysqli->close();
?>

锟斤拷锟教伙拷锟斤拷锟�

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

/* check connection */
if (mysqli_connect_errno()) {
    
printf("Connect failed: %s\n"mysqli_connect_error());
    exit();
}

/* print protocol version */
printf("Protocol version: %d\n"mysqli_get_proto_info($link));

/* close connection */
mysqli_close($link);
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

Protocol version: 10

锟轿硷拷

  • mysqli_get_host_info() - 锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷使锟矫碉拷锟斤拷锟斤拷锟斤拷锟酵碉拷锟街凤拷锟斤拷