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:
WebSocket, the front-end is holding on to the browser, and the mysql changes monitored by the backend.
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.