Home  >  Article  >  Backend Development  >  求问 如何 在运行一半时先返回数据给用户,然后结束网络连接,然后自己继续计算。

求问 如何 在运行一半时先返回数据给用户,然后结束网络连接,然后自己继续计算。

WBOY
WBOYOriginal
2016-06-23 13:15:571060browse

1 用户提交请求

2 服务器 快速计算后 返回结果给用户,并结束 网络连接

3 服务器自己 继续 根据刚才的请求 计算耗时的 东西, 最后算出的结果 不需要返回给用户。

请问  第2步、第3步 。。。要怎么写啊。。。


回复讨论(解决方案)

echo '返回给用户';
ob_flush();
flush();
ignore_user_abort()
...继续处理

echo '返回给用户';
ob_flush();
flush();
ignore_user_abort()
...继续处理



感谢
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn