Database changes are implemented on the php page, and the page is automatically refreshed

Source: Internet
Author: User
Php page changes the database, page automatically refreshed how to achieve database changes without polling php page, page automatically refreshed

How to Implement
No polling

Reply content:

Database changes are implemented on the php page, and the page is automatically refreshed

How to Implement
No polling

WebSocket may be what you need

You can only use WebSocket without training. Few browsers are supported.

Page refreshing is a browser action and cannot be controlled by php.
The following methods are available:

  1. WebSocket, the front-end is holding on to the browser, and the mysql changes monitored by the backend.

  2. The front-end uses js for regular checks and keeps pulling back-end php and php to check whether mysql Data has changed. Similar to segmentfault.com, or scan the QR code to log in.

Since LZ says no polling is required, you can eliminate the Ajax long round training first. There are only two solutions listed below, but the second is not recommended.

1. Websocket: as many people have said above.

2. Server Send Event: few browsers are supported. If your scenario permits this, try it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.