如何在GAE / PHP中向用户刷新html? [英] How to flush html to the user in GAE/PHP?

查看:77
本文介绍了如何在GAE / PHP中向用户刷新html?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google App Engine上使用PHP - 如何将html发送给用户并继续运行php脚本?



这就是我一直在尝试的远,但它不起作用。浏览器仅在整个脚本执行后才显示页面:

  ob_start(); 

$ url = $ _POST ['url'];

$ html = file_get_html($ url);

echo $ html;

ob_flush();

//在这里耗时的处理...


解决方案你不能这样做 - 响应只在脚本完成后发送给用户。



如果你想在响应之后做一些处理我建议您使用任务队列


Using PHP on Google App Engine - How do I send the html to the user and continue running the php script?

this is what I've been trying so far, but it doesn't work. The browser displays the page only after the entire script was executed:

ob_start();

$url = $_POST['url'];

$html = file_get_html($url);

echo $html;

ob_flush ();

// time consuming processing here...

解决方案

You cannot do it - the response is only sent to the user once the script has completed.

If you want to do some processing after the response is sent the I suggest you use task queues.

这篇关于如何在GAE / PHP中向用户刷新html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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