我在我的Web服务器上使用的是PHP5.5。现在我想要使用pthread。以下是我的PHP配置:http://dd19010.kasserver.com/infophp.php55
实施此代码后......
<?php
class AsyncOperation extends Thread
{
public function __construct($threadId)
{
$this->threadId = $threadId;
}
public function run()
{
printf("T %s: Sleeping 3sec\n", $this->threadId);
sleep(3);
printf("T %s: Hello World\n", $this->threadId);
}
}
$start = microtime(true);
for ($i = 1; $i <= 5; $i++) {
$t[$i] = new AsyncOperation($i);
$t[$i]->start();
}
echo microtime(true) - $start . "\n";
echo "end\n";
?>
... 问题就在这个错误上:Fatal error: Class 'Thread' not found in。 我需要包含一些 include_once 或类似的东西才能让它工作吗? 我该怎么做??