向客户端报告进度的PHP脚本 [英] PHP script that reports progress to Client

查看:65
本文介绍了向客户端报告进度的PHP脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个执行大量重复工作的PHP脚本,当客户端执行该脚本时,我希望它在完成任务时以某种方式动态地发回HTML。 (没有AJAX?)如何完成?

I'm writing a PHP script that does a lot of repetitive work, and when the client executes it, I'd like it to send back HTML in some way, dynamically, as it completes tasks. (without AJAX?) How can this be done?

推荐答案

您可以使用flush()刷新输出缓冲区。

You can flush the output buffer, using flush();

所以像这样:

taskOne();
echo 'Task one finished';
flush();
...

希望这会有所帮助。

这篇关于向客户端报告进度的PHP脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆