PHP code example of ywna / swbt
1. Go to this page and download the library: Download ywna/swbt 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/ */
ywna / swbt example snippets
swb/config/SWBT.php
return [
'tubes' => [
//队列处理管道名称
'test' => [
'worker_num' => 3, //处理进程数量
'class' => \SWBT\Worker\TestWorker::class //队列处理类
]
]
];
namespace Monkey\Worker;
use SWBT\Code;
use SWBT\Worker\BaseWorker;
use SWBT\Worker\Worker;
class TestWorker extends BaseWorker implements Worker
{
public function handleJob()
{
echo 'do something';
return ['code'=>Code::$success];
// return ['code'=>Code::$delayed];
// return ['code'=>Code::$buried];
}
}