为什么需要这个函数的最后一行才能完成这项工作?我不明白这里发生了什么。不过它确实有效。
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 ' ';
}