How can I execute PHP code on page close?

前端 未结 6 1936
心在旅途
心在旅途 2021-01-06 04:01

I am trying to find a method to execute some PHP code once a user closes the page. In my application, once the user closes or navigates away from the page the server will st

6条回答
  •  Happy的楠姐
    2021-01-06 04:12

    If you put in a ajax script that refreshes after 5-10 seconds, you can update the last updated stamp via the php file that the ajax request calls, and if its older than 10 seconds it went offline. That could certainly be a cleaner solution :-)

提交回复
热议问题