CakeFest 2024: The Official CakePHP Conference

zend_thread_id

(PHP 5, PHP 7, PHP 8)

zend_thread_id返回当前线程的唯一识别符

说明

zend_thread_id(): int

该函数返回当前线程的唯一识别符。

参数

此函数没有参数。

返回值

以整型(integer)返回线程的 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)时。

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top