0

I use pcntl_signal function to handle Ctrl+Z, Ctrl+C and exit at safe point from the application.

Can I do the same when user close window?

4

1 回答 1

1

试试挂机信号。

SIGHUP

您可以使用: http ://en.wikipedia.org/wiki/Unix_signal

查找和概览每个信号的发送时间。

没有特定于特定“选项卡/窗口”关闭信号的 UI,您必须连接到 X11 才能完成类似的事情(当然不推荐,尤其是在 PHP 中),但 SIGHUP 可能是您需要的。

有一个 SIGCHLD 但我不知道任何表明父母正在终止的事情,这就是您关闭选项卡或窗口时发生的情况。

于 2014-09-27T13:51:08.783 回答