我想在 PHP 中使用线程。我正在使用 windows 。需要做什么才能做到这一点。这是我正在运行的代码。
<?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();
?>
Run Code Online (Sandbox Code Playgroud)
当我运行它显示的代码时
致命错误:在第 2 行的 D:\xampp\htdocs\my.php 中找不到“线程”类
提前致谢