0

according to Chunked transfer encoding - browser behavior

set_time_limit(0);

header('Content-Encoding: chunked');
header('Transfer-Encoding: chunked');
header('Content-Type: text/plain;charset=utf-8');
header('Connection: keep-alive');

echo str_pad('', 1024, ' ');

while (true) {
// do some echo 
    ob_flush();
    flush();
}

hi guys, any problem with my code? it is not work in chrome. work good in curl & safari.

Community
  • 1
  • 1

1 Answers1

1

this works.

set_time_limit(0);

header('Content-Encoding: chunked');
header('Transfer-Encoding: chunked');
header('Content-Type: text/plain;charset=utf-8');
header('Connection: keep-alive');

while (true) {
    echo str_pad('', 1024, ' ');// browser/nginx/fastcgi max buffer size
    // do some echo

    // ob_flush();
    flush();
}