为什么要使这个功能的最后一行工作?我不明白这里发生了什么。它确实有用。
function close_connection() {
// if we're using sessions this stops them from hanging on other requests
session_write_close();
// get the content length from the buffer (the whole point of the buffer)
header('Content-Length: 0');
// close the connection
header('Connection: close');
// flush the buffers to the screen
flush();
// connection closing doesn't work without this. I don't know why
echo ' ';
}
答案 0 :(得分:1)
只要第一个字节输出到浏览器,就会发送标头
您也可以尝试使用ob_end_flush();