Latest web development tutorials

PHP mysqli_get_connection_stats () function

PHP MySQLi Reference Manual PHP MySQLi Reference Manual

Examples

Returns statistics about the client connection:

<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检测连接
if (mysqli_connect_errno($con))
{
    echo "数据库连接失败: " . mysqli_connect_error();
}

print_r(mysqli_get_connection_stats($con));

mysqli_close($con);
?>

Definition and Usage

mysqli_get_connection_stats () function returns information about the client connection statistics.


grammar

mysqli_get_connection_stats( connection ) ;

参数 描述
connection 必需。规定要使用的 MySQL 连接。

technical details

return value: If successful, it returns an array with the statistics of the connection, if that fails it returns FALSE.
PHP version: 5.3+


PHP MySQLi Reference Manual PHP MySQLi Reference Manual