简体   繁体   中英

How can I flash the latest messages given by users, among multiple users, using PHP, just like Twitter tweets works?

像Twitter推文一样,如何使用PHP刷新多个用户之间的用户给出的最新消息?

You need to use AJAX for that one and shown in a common page.

Algo:

  1. Send a request to the server to check if there are any updates in (for example) your message_table.
  2. If there is, return the newly added message. Send a NONE message if none and return to step 1.

You can also try reading http://en.wikipedia.org/wiki/Comet_(programming) which is an optimized way to do this. Or if not, you can do it with the traditional ajax polling.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM