在PHP检测浏览器退出 [英] Detecting Browser exit in PHP
本文介绍了在PHP检测浏览器退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经看过几个主题(这里和放大器;谷歌)关于PHP检测浏览器的退出和IM没有真正的更清楚如何做到这一点。
I have looked at a few topics (here & google) regarding detecting browser exit in php and im not really any clearer on how to do so.
我试过 register_shutdown_function
在PHP但是当我刷新浏览器页面正在执行偶数。
I tried the register_shutdown_function
in PHP but that was executing even when i refreshed the browser page.
谁能帮助?
在此先感谢
推荐答案
PHP是一个服务器端语言。浏览器事件通过DOM事件来处理。在onunload的或onbeforeunload事件,发送一个AJAX调用的PHP文件。
PHP is a server side language. Browser events are handled by DOM events. On "onunload" or "onbeforeunload" events, sending an AJAX call to a PHP file.
And in this other question there is a flavored explanation of what I'm saying.
这篇关于在PHP检测浏览器退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文