array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.mysql-thread-id.php', 1 => 'mysql_thread_id', ), 'up' => array ( 0 => 'ref.mysql.php', 1 => 'MySQL 函数', ), 'prev' => array ( 0 => 'function.mysql-tablename.php', 1 => 'mysql_tablename', ), 'next' => array ( 0 => 'function.mysql-unbuffered-query.php', 1 => 'mysql_unbuffered_query', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/mysql/functions/mysql-thread-id.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.3.0, PHP 5)
mysql_thread_id — 返回当前线程的 ID
本扩展自 PHP 5.5.0 起已废弃,并在自 PHP 7.0.0 开始被移除。应使用 MySQLi 或 PDO_MySQL 扩展来替换之。参见 MySQL:选择 API 指南来获取更多信息。用以替代本函数的有:
检索当前线程 ID。如果连接丢失并执行 mysql_ping() 重新连接,会改变线程 ID。这意味着仅能在需要的时候再去获取。
link_identifier
MySQL
连接。如不指定连接标识,则使用由 mysql_connect()
最近打开的连接。如果没有找到该连接,会尝试不带参数调用
mysql_connect()
来创建。如没有找到连接或无法建立连接,则会生成
E_WARNING
级别的错误。
The thread ID on success 或者在失败时返回 false
.
示例 #1 mysql_thread_id() 示例
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$thread_id = mysql_thread_id($link);
if ($thread_id){
printf("current thread id is %d\n", $thread_id);
}
?>
以上示例的输出类似于:
current thread id is 73