PHP mysqli_thread_id () function
Returns the thread ID of the current connection, and then kill the connection:
<?php // 假定数据库用户名:root,密码:123456,数据库:w3big $con=mysqli_connect("localhost","root","123456","w3big"); if (mysqli_connect_errno($con)) { echo "连接 MySQL 失败: " . mysqli_connect_error(); } // 获取线程 id $t_id=mysqli_thread_id($con); // 杀死线程 mysqli_kill($con,$t_id); ?>
Definition and Usage
mysqli_thread_id () function returns the thread ID of the current connection, and then use mysqli_kill () function to kill the connection.
Note: If the connection is damaged and reconnected, the thread ID will change. Therefore, only when you need to obtain the thread ID.
grammar
mysqli_thread_id( connection ) ;
参数 | 描述 |
---|---|
connection | 必需。规定要使用的 MySQL 连接。 |
technical details
return value: | Returns the thread ID for the current connection. |
---|---|
PHP version: | 5+ |
PHP MySQLi Reference Manual