当 MySql 数据库条目发生更改时发送通知
我编写了一个 php 文件,该文件在收到 http post 时会更改 MySql 表条目。我还希望 php 文件向表条目的所有者发送通知。这个想法类似于聊天室或即时通讯程序。我看过 php 聊天脚本,但我确实需要一些具有非常简单的可定制界面的东西。有人能指出我正确的方向吗?
I've written a php file that changes a MySql table entry when it receives an http post. I would also like the php file to send out a notification to the table entry's owner. This idea is similar to a chat room or instant messengering program. I've looked at php chat scripts but I really need something that has a very simple interface that is customizable. Can anyone point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
那么您想同步一组客户端,是吗?
如果是这样,请查看长轮询技术。非常简单:客户端打开连接,但服务器在数据更新之前不会响应。
缺点是这不适用于 PHP。您将需要 sleep() 多个连接,因此会阻塞 PHP 进程。
如果您有可能,我建议您使用node.js 来做类似的事情。使用节点实现长轮询聊天非常简单;)
So you want to synchronize a set of clients, do you?
If so, look at the Long Polling technique. It's quite simple: The client opens a connection but the server does not respond until data is updated.
On the downside this won't work well with PHP. You will need to sleep() several connections, therefore blocking PHP processes.
If you have the possibility I would recommend using node.js to do stuff like that. Long Polling Chats are quire simple to implement using node ;)
我将使用命名查找来触发事件和 jabber 机器人(存在多种语言的扩展)。
http://www.xaprb.com/blog/2007/08/29/how-to-notify-event-listeners-in-mysql/" xaprb.com/blog/2007/08/29/how-to-notify-event-listeners-in-mysql/
I would use a named look for event triggerning and a jabber bot (extensions exist for several languages).
http://www.xaprb.com/blog/2007/08/29/how-to-notify-event-listeners-in-mysql/