PHP - Thread::getCurrentThreadId() 函式



Thread::getCurrentThreadId - 標識

語法

public static integer Thread::getCurrentThreadId( void )

Thread::getCurrentThreadId() 函式可以返回當前正在執行的執行緒的標識。

Thread::getCurrentThreadId() 函式沒有任何引數,並且可以返回一個數字標識。

示例

<?php
   class My extends Thread {
      public function run() {
         printf("%s is Thread #%lu\n", __CLASS__, Thread::getCurrentThreadId());
      }
   }
   $my = new My();
   $my->start();
?>
php_function_reference.htm
廣告