2017-05-11 59 views

回答

0

Windows支持線程對我來說都是新聞。 pthreads中的P表示Unix,就像POSIX一樣。

這是一個不同的方向,但也許Linux的Windows子系統值得研究。它應該爲Windows環境提供基本的POSIX兼容性。

0

首先,

您是否在添加模塊後重新啓動Apache? 如果沒有,你應該這樣做。

接下來, 嘗試基本的PHP多線程程序

<?php 
class AsyncOperation extends Thread { 
    public function __construct($arg){ 
    $this->arg = $arg; 
    } 

    public function run(){ 
    if($this->arg){ 
     printf("Hello %s\n", $this->arg); 
    } 
    } 
} 
$thread = new AsyncOperation("World"); 
if($thread->start()) 
    $thread->join(); 
?> 

你似乎已經按照所有必要的步驟。應該從那裏直截了當。

+0

嗨Naresh,我重新啓動Apache幾次.... –

+0

解決!第一個錯誤是pthreads的錯誤版本,第二個我沒有將pthreadVC2.dll放到'C:\ windows \ system32'目錄下。 你可以在這裏找到很好的教程:http://php.net/manual/en/pthreads.installation.php –