grandmasterx/yii2-multithreading

适用于php 5.3+的多线程类

dev-master 2015-01-27 13:33 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:39:49 UTC


README

适用于php 5.3+的多线程类

安装

安装此扩展的首选方式是通过 Composer

运行以下命令之一

php composer.phar require --prefer-dist grandmasterx/yii2-multithreading "*"

或者在您的 composer.json 文件的 require 部分添加以下内容

"grandmasterx/yii2-multithreading": "*"

使用方法

扩展安装完成后,只需在您的代码中通过以下方式使用它

$threads = new Threads;
$threads->newThread(dirname(__FILE__).'/file.php', array());
while (false !== ($result = $threads->iteration())) {
    if (!empty($result)) {
        echo $result."\r\n";
    }
}
echo (date("H:i:s"));
$end = microtime(true);
echo "Execution time ".round($end - $start, 2)."\r\n";
die;