小编moi*_*l15的帖子

如何在 Windows 上的 PHP 中使用线程

我想在 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 中找不到“线程”类

提前致谢

php installation multithreading

3
推荐指数
1
解决办法
7034
查看次数

标签 统计

installation ×1

multithreading ×1

php ×1