Current Location: Home> Function Categories> mysqli::$protocol_version

mysqli::$protocol_version

(mysqli_get_proto_info) Returns the version of the MySQL protocol used
Name:mysqli::$protocol_version
Category:MySQLi
Programming Language:php
One-line Description:Get the version number of the MySQL server protocol currently in use

The function mysqli::$protocol_version() is used to obtain the version number of the currently used MySQL server protocol. It returns a string indicating the version number.

Usage example:

 <?php // 创建MySQLi对象$mysqli = new mysqli("localhost", "username", "password", "database"); // 检查连接是否成功if ($mysqli->connect_errno) { echo "连接失败: " . $mysqli->connect_error; exit(); } // 获取MySQL服务器协议版本号$protocolVersion = $mysqli->protocol_version; echo "MySQL服务器协议版本号: " . $protocolVersion; // 关闭连接$mysqli->close(); ?>

In the example above, we first created a MySQLi object and made a connection. Then, we use $mysqli->protocol_version to access mysqli::$protocol_version property to get the version number of the MySQL server protocol. Finally, we print out the version number.

Please note that mysqli::$protocol_version property is read-only and cannot be modified by assignment.

Similar Functions
Popular Articles