Home > Backend Development > PHP Tutorial > How to continue to listen to redis message subscription in php

How to continue to listen to redis message subscription in php

WBOY
Release: 2016-09-12 17:44:43
Original
2109 people have browsed it

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.

Reply content:

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template