PHP flush the output to browser

前端 未结 2 1543
-上瘾入骨i
-上瘾入骨i 2021-01-22 20:27

I work on a PHP project and I use flush().

I did a lot of search and found that PHP sends long outputs of scripts to the browser in chunk parts and does not

2条回答
  •  野性不改
    2021-01-22 21:32

    i think you are wrong see this code

    echo str_repeat(' ',1024);
    for($i=0;$i<10;$i++){
    echo $i;
    flush();
    sleep(1);   
    

    if you run it see that every 1 byte sent to browser and print //the str_repeat is for browser buffer for showing data and nothing else

提交回复
热议问题