简单的实现方法是使用javascript setTimeout和setInterval来检查服务器状态,并在mysql上使用触发器/存储过程.深入了解彗星.有两本很酷的书: Comet and Reverse Ajax 2008作者Dave Crane 第4章(内容河)-构建实时泰德·罗登(Ted Roden)的《 2010年用户体验》 how can I automatically add the value of a database row (PHP), to the page, without refreshing the page itself, when the mysql database table changes?So, it is a bit like this: Automatically refresh browser in response to file system changes? , but instead of refreshing the browser with the file system changes, update the content, without refreshing anything, when the databse changes.Thanks. I have tried to make this as clear as possible. 解决方案 This is called Comet/Reverse Ajax/HTTP server push http://en.wikipedia.org/wiki/Comet_(programming). They are many techniques for doing this as well as many existing frameworks to do it for you.There are many answers in SO about Comet https://stackoverflow.com/search?q=cometSimple implementation would be javascript setTimeout and setInterval to check server status, with trigger/stored procedure on mysql.For depth dive into Comet. There are two cool books about this:Comet and Reverse Ajax 2008 By Dave CraneChapter 4 (River of Content) - Building the Realtime User Experience 2010 By Ted Roden 这篇关于如果数据库更改,则自动刷新内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-01 21:44