一旦实现连接关闭,PHP通常会终止脚本执行:
PHP will not detect that the user has aborted the connection until an
attempt is made to send information to the client. Simply using an
echo statement does not guarantee that information is sent,see
flush().
您可以使用ignore_user_abort()保持脚本运行.
此外,还有一个默认的时间限制允许哪些脚本运行.您可能想要使用set_time_limit()覆盖.