💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# swoole_redis->on 注册事件回调函数。 ```php function swoole_redis->on(string $event_name, callable $callback); ``` 目前`swoole_redis`支持2种事件回调函数。`on`方法必须在`connect`前被调用。 onClose ----- 当Redis服务器主动关闭连接或者客户端主动调用close关闭连接时,会触发`onClose`事件。 ```php function onClose(swoole_redis $redis); ``` onMessage ---- 当客户端收到来自服务器的订阅消息时触发onMessage事件。 ```php function onMessage(swoole_redis $redis, array $message); ```