start_test.php代码:
<?php
use \Workerman\Worker;
use \Workerman\Lib\Timer;
require __DIR__ . '/../../vendor/autoload.php';
$task = new Worker();
$task->count = 1;//单进程处理
$task->name = 'test';
$task->onWorkerStart = function() use ($transaction){
Timer::add('1', function () {
echo 'test:1......' . PHP_EOL;
});
};
// 运行worker
Worker::runAll();
strt_test1.php代码:
<?php
use \Workerman\Worker;
use \Workerman\Lib\Timer;
require __DIR__ . '/../../vendor/autoload.php';
$task = new Worker();
$task->count = 1;//单进程处理
$task->name = 'test2';
$task->onWorkerStart = function() use ($transaction){
Timer::add('1', function () {
echo 'test:2......' . PHP_EOL;
});
};
// 运行worker
Worker::runAll();
运行php start.php start 的时候,只能启动第一个,请问是什么情况呀?
环境PHP7.1 workerm最新版,CentOS
参考代码:
==============start.php=============
============start_test1.php=============
============start_test2.php=============
感谢!