PHP mysqli_kill () function
Examples
Returns the thread ID of the current connection, and then kill the connection:
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检测连接
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// 获取线程 ID
$t_id=mysqli_thread_id($con);
// 杀死线程
mysqli_kill($con,$t_id);
?>
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// 检测连接
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// 获取线程 ID
$t_id=mysqli_thread_id($con);
// 杀死线程
mysqli_kill($con,$t_id);
?>
Definition and Usage
mysqli_kill () function requests the server to kill a MySQL parameters specified by processid thread.
grammar
mysqli_kill( connection,processid ) ;
参数 | 描述 |
---|---|
connection | 必需。规定要使用的 MySQL 连接。 |
processid | 必需。由 mysqli_thread_id() 返回的线程 ID。 |
technical details
return value: | If successful it returns TRUE, on failure returns FALSE. |
---|---|
PHP version: | 5+ |
PHP MySQLi Reference Manual