php关闭连接并继续在背景上

时间:2013-07-13 10:10:13

标签: php codeigniter iis fastcgi background-process

如何在以下环境中关闭连接并继续后台?

服务器:Microsoft-IIS / 7.0

PHP支持:(作为FastCGI应用程序运行)

PHP版本:5.2.17

主持人:共享,CRON:否

我尝试了很多现有的解决方案,它适用于本地wamp服务器或PHP LINUX服务器,但不适用于IIS。

// buffer all upcoming output
ob_start();
echo "Here's my awesome web page";

// get the size of the output
$size = ob_get_length();

// send headers to tell the browser to close the connection
header("Content-Length: $size");
header('Connection: close');

// flush all output
@ob_end_flush();
@ob_flush();
@flush();

// close current session
if (session_id()) session_write_close();

sleep(10);

// DO SOME BACKGROUND WORK ...

请帮忙。

由于

1 个答案:

答案 0 :(得分:-1)