在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.