Detect browser connection closed in PHP

假装没事ソ 提交于 2019-12-01 04:51:16

In at least PHP4, connection_aborted and connection_status only worked after the script sent any output to the browser (using: flush() | ob_flush()). Also don't expect accurately timed results.

It's mostly useful to check if there is still someone waiting on the other side.

http://nz.php.net/register-shutdown-function

Probably less complicated if you just want a script to die and handle it when a user terminates.

( Ie: if it was a lengthy search, this would save you a bunch of operation cycles )

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!