PHP code example of out001a / tasque
1. Go to this page and download the library: Download out001a/tasque library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
out001a / tasque example snippets
// 初始化,自定义一些参数
Process::init(消息队列对象, 同时存在的最大子进程数, fork子进程的时间间隔);
Process::register('taskCount', function () {
// 返回待处理的任务数(随便写个数也可以😄)
return 1;
});
Process::register('dispatch', function() {
// 分发待处理的任务列表,需要返回array
return array();
});
Process::register('worker', function() {
// 注册work进程的业务逻辑
return do_work();
});
// 执行
Process::handle();