略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Thread::getCurrentThread

2024-04-29

Thread::getCurrentThread

(PECL pthreads >= 2.0.0)

Thread::getCurrentThread识别

说明

public static Thread::getCurrentThread(): Thread

获取当前执行线程的引用。

参数

此函数没有参数。

返回值

表示当前执行线程的对象。

范例

示例 #1 获取当前执行线程

<?php
class My extends Thread {
    public function 
run() {
        
var_dump(Thread::getCurrentThread());
    }
}
$my = new My();
$my->start();
?>

以上例程会输出:

object(My)#2 (0) {
}
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/thread.getcurrentthread.php

冷却塔厂家 广告
中文GPT4.0无需注册 广告
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3