zend_thread_id()
(PHP 5, PHP 7)
返回当前线程的唯一识别符
说明
zend_thread_id(void): int
该函数返回当前线程的唯一识别符。
返回值
以整型(integer)返回线程的 ID。
范例
Example #1zend_thread_id()例子
<?php $thread_id = zend_thread_id(); echo 'Current thread id is: ' . $thread_id; ?>
以上例程的输出类似于:
Current thread id is: 7864
注释
Note:该函数仅在以下情况有效:PHP 内置 ZTS(Zend 线程安全)的支持,并开启调试模式(--enable-debug)时。