CakeFest 2024: The Official CakePHP Conference

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 note

User Contributed Notes

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