<?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(); ?>运行以上代码得到“HelloWorld”,就说明安装pthreads扩展成功!
PHP安装pthreads多线程扩展教程[windows篇]
原文:http://blog.csdn.net/aoyoo111/article/details/19020161