PHP - Thread::getCurrentThread() 函式



Thread::getCurrentThread — 標識

語法

public static Thread Thread::getCurrentThread ( void )

Thread::getCurrentThread() 函式可以返回對當前正在執行的執行緒的引用。

Thread::getCurrentThread() 函式沒有任何引數,可以返回一個表示當前正在執行的執行緒的物件。

示例

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