版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_37281289/article/details/86072923
如题:
服务端php代码如下:(浏览器和curl的请求都可以使用)
//要输出到浏览器的内容, nginx服务器缓存内容需要大于65536才能输出 $str = str_repeat(' ', 65536); //告诉浏览器数据长度,浏览器接收到此长度数据后就不再接收数据 header("Content-Length:" . strlen($str)); //告诉浏览器关闭当前连接,即为短连接 header("Connection: close"); ob_end_clean (); ob_start(); echo $str;//在浏览器上显示 ob_end_flush(); if (ob_get_level() > 0) { ob_flush(); } flush();
//忽略用户终端请求 ignore_user_abort(true); // 设置最大执行时间为15分钟 ini_set("max_execution_time", "666");
//str结果返回给浏览器后, 你仍然要执行的代码写在下方