Print PHP live and not wait for the whole while loop to end

0

Good, what I try to do is in a while print live each route, because in PHP it waits for the entire while or for loop to finish showing everything printed on screen.

Similar to a form with ajax, but this way with ajax, it will print at the end ending the while with php.

I tried to do append of jquery but it's the same.

I guess I have to work with javascript to print live.

This I do because my scripts take too long to print and I want to monitor if it's advanced or stuck hanging on something.

Some suggestions please

    
asked by Goakof 06.11.2017 в 16:46
source

1 answer

0

PHP, usually, manages an output buffer, sending the browser packages with a certain amount of data. The easiest way to start printing is to empty that buffer:

while(/* condición */) {
    /* Aquí el armado de tu HTML */
    flush();
}

Function flush () .

    
answered by 07.11.2017 / 01:21
source