Home >Backend Development >PHP Tutorial >How to continue to listen to redis message subscription in php
How to implement message subscription to redis through php. For example, I want to use PHP to develop some websites that display messages in real time based on redis message subscription.
How to implement message subscription to redis through php. For example, I want to use PHP to develop some websites that display messages in real time based on redis message subscription.
Usage:
Subscriber: Subscribe channel name
Publisher: publish channel name Publish content
Example:
Client example:
redis 127.0.0.1:6379> subscribe news
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "news"
3) (integer) 1
1) "message"
2) "news"
3) "good good study"
1) "message"
2) "news"
3) "day day up"
Server example:
redis 127.0.0.1:6379> publish news 'good good study'
(integer) 1
redis 127.0.0.1:6379> publish news 'day day up'
(integer) 1