Here’s my code:
ignore_user_abort(true); set_time_limit(0); ob_start(); // do initial processing here echo "content 1"; // send the response header('Connection: close'); header('Content-Length: '.ob_get_length()); ob_end_flush(); ob_flush(); flush(); //do expensive processing here (user will never see this) echo "content 2";
what this do is, to make php close connection early so user will not wait longer when the server do expensive processing.
If i refresh browser multiple times, sometimes it shows “content”, sometimes it shows “content 1”. Why is that?
If I turn off my cloudflare and refrsh the page multiple times it always shows “content 1” all the time.
Is this CF bug?