Posted by Chung Leong on 11/01/18 11:49
S. C. Jeong wrote:
> I want to send 'eof' kind of message after some processes. Die or exit
> cannot be used because there are some more processes to complete, but
> nothing major to users.
>
> <?php
> phpinfo ();
> //i want to finish the process here!!
> //flush () //? doesnt work?
> sleep (10); // mimic of (not)complicated process
> ?
>
> Help me to solve this problem :)
>
> Calvin J
Try turning on output buffering and setting the Content-Length header
before sending the contents.
<?
ob_start();
/* ... do stuff ... */
$s = ob_get_clean();
$len = strlen($s);
header("Content-Length: $len");
echo $s;
?>
Might want to set the Connection header to 'closed' as well.
[Back to original message]
|