0
由於某種原因,我的run方法沒有被調用?任何想法,我要去錯了嗎?PHP線程運行方法不被稱爲
<?php
class WorkerThread extends Thread
{
private $i = 0;
public function __construct($i)
{
$this->i = $i;
}
public function run()
{
$a = 0;
while($a < 100)
{
file_put_contents("test" . $this->i . ".txt", $a, FILE_APPEND);
sleep(5);
}
}
}
$workers = array();
for ($i = 0; $i < 3; $i++)
{
$workers[ $i ] = new WorkerThread($i);
$workers[ $i ]->start();
}
?>
謝謝老兄,不敢相信xdebug不讓我看到那個! – Jimmyt1988