(PHP 5, PHP 7, PHP 8)
zend_thread_id — 返回当前线程的唯一标识符
此函数没有参数。
返回线程 ID,作为整数。
示例 #1 zend_thread_id() 示例
<?php
$thread_id = zend_thread_id();
echo 'Current thread id is: ' . $thread_id;
?>
以上示例将输出类似于以下内容
Current thread id is: 7864
注意:
只有在 PHP 使用 ZTS(Zend 线程安全)支持和调试模式(
--enable-debug
)构建时,此函数才可用。