pthread не работает в php
Я скачалPHP Pthreads DLL файл изhttp://windows.php.net/downloads/pecl/releases/pthreads/ и включил его в php.ini, как показано ниже:
extension=pthreadVC2.dll
extension=php_pthreads.dll
Я использовал ниже пример кода:
<?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();
когда я выполнил код, я получил следующую ошибку:
Неустранимая ошибка: класс 'Thread' не найден в C: \ htdocs \ threads \ AsyncOperation.php в строке 2: стек вызовов: 0.0008 333464 1. {main} () C: \ htdocs \ threads \ AsyncOperation.php: 0