這里詳細描述問題
這里粘代碼
<?php
namespace process;
use support\Log;
use support\Redis;
class Async
{
/**
這里粘貼報錯
worker[async:122068] exit with status 64000
RedisException: read error on connection to 127.0.0.1:6379 in webman/vendor/illuminate/redis/Connections/PhpRedisConnection.php:461
Stack trace:
webman/vendor/illuminate/redis/Connections/PhpRedisConnection.php(461): Redis->subscribe()
這里寫具體的系統(tǒng)環(huán)境相關(guān)信息
4.2.1版本
有沒有可能 127.0.0.1:6379 本地環(huán)境redis沒有啟動
不太清楚,用Redis::subscribe調(diào)用訂閱 就一直繁忙 然后框架拋出異常64000,我是換成
public function onWorkerStart()
{
$redis = new \Workerman\Redis\Client('redis://127.0.0.1:6379');
$redis->subscribe('asyncpub',function ($channel, $message){
if(!empty($message)){
$message = json_decode($message, true);
switch ($message['datatype']){
case 'request':
$this->https_curl($message['url'], [], 'GET');
break;
case 'cmd':
shell_exec($message['commend']['cli'].' '.implode(' ',$message['commend']['param']));
break;
default:
}
}
Log::info("訂閱消息接收參數(shù)",['message'=>$message]);
});
}
這種寫法