函数名称:Thread::getCreatorId()
适用版本:PHP 7.2.0 以上
函数描述:Thread::getCreatorId() 函数用于获取创建线程的用户 ID。
用法示例:
<?php
// 创建一个线程
$thread = new Thread(function(){
// 获取创建线程的用户 ID
$creatorId = Thread::getCreatorId();
echo "线程创建者的用户 ID 是:".$creatorId;
});
// 启动线程
$thread->start();
?>
说明:
注意事项: