eaglewu / fork-helper
一个简单的PHP进程分叉类,允许多线程
2.0.1
2016-11-19 06:38 UTC
Requires
- php: ^7.0
Requires (Dev)
- mockery/mockery: ^0.9.5
- phpunit/phpunit: ^5.6
Suggests
- ext-pcntl: Needed to allow multi-threaded execution of code
- ext-shmop: If pcntl is present then shmop is required to handle errors
README
一个简单的PHP进程分叉类,允许多线程。
完整文档可在http://duncan3dc.github.io/fork-helper/找到
PHPDoc API文档也可在http://duncan3dc.github.io/fork-helper/api/找到
快速示例
异步运行一些代码
$fork = new \duncan3dc\Forker\Fork; $fork->call(function () { for ($i = 1; $i <= 3; $i++) { echo "Process A - " . $i . "\n"; sleep(1); } }); $fork->call(function () { for ($i = 1; $i < 3; $i++) { echo "Process B - " . $i . "\n"; sleep(1); } }); sleep(1); echo "Waiting for the threads to finish...\n"; $fork->wait(); echo "End\n";
更多信息请查阅http://duncan3dc.github.io/fork-helper/
变更日志
自2.0.0版本起,已有变更日志
获取帮助的地方
发现了一个错误?有一个问题?或者不确定某件事是如何工作的?
请创建一个issue,我会尽力帮助您。
或者您可以在Twitter上找到我