# php消息队列 **Repository Path**: more7/php-queue ## Basic Information - **Project Name**: php消息队列 - **Description**: 使用PHP和redis实现的消息队列 - **Primary Language**: PHP - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-02-21 - **Last Updated**: 2023-02-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # php队列 #### 介绍 使用PHP和redis实现的消息队列 ### 使用 // 普通模式 include 'Query.php'; include 'Test.php'; include 'RedisConfig.php'; // 生产者 $config = (new RedisConfig)->setHost('192.168.174.130')->setPort('6379')->setAuth('123456')->setSelect(0); $Query = new Query($config); for ($i = 0; $i <= 1000; $i++) { echo $Query->getQueue('test')->push(Test::class, ['time' => time(), 'name' => 'chenhuan', 'num' => $i]), PHP_EOL; } // 消费者 $config = (new RedisConfig)->setHost('192.168.174.130')->setPort('6379')->setAuth('123456')->setSelect(0); $Query = new Query($config,3); $Query->work('test'); //消费者swoole use function Swoole\Coroutine\run; run(function () { $config = (new RedisConfig)->setHost('192.168.174.130')->setPort('6379')->setAuth('123456')->setSelect(0); $Query = new Query($config,3); $Query->work('test'); }); ### 具体请看代码