duandao1931 2018-01-30 01:55
浏览 64
已采纳

PHP Web应用程序自动刷新Observer模式

I am programming web applications for a while now and over the time they became more sophisticated, but sometimes I am not sure if the ways I go are common. Now I am diving into design pattern and thinking about ways to dynamically refresh the contents of the page if the data has changed.

Typically this would be the observer pattern. Now my question. What are the professional ways to automatically load the new data in an open web application? It would work with javascript and a refresh of the page, sure. But what if javascript is not available?

The observable should notify the observers and force them to update it's data. I would really appreciate a conversation about this topic to get some ideas for future projects.

  • 写回答

1条回答 默认 最新

  • dongren4147 2018-01-30 02:00
    关注

    For web applications usually used WebSocket. PHP only runs on the server once per session you can send the command to subscribers via WebSocket and on client browser javascript can react on it and for example, send the request with another query to your script.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部