shaunshull Posted March 26, 2007 Share Posted March 26, 2007 Anyone know of a way to return data to a browser and then continue processing code. For example in classic ASP they have: <% Response.write('THE BROWSER CAN SEE THIS'); // sending final response to the browser Response.end; // this will still execute even though the browser no longer is waiting for a response my_function(); %> I would like to immediately return a value to the browser and then run cleanup code without the browser having to wait. When I use the exit() or die() or return() functions in PHP it will end the code right at that point which is great because the browser gets a response back quickly but the remaining code never gets executed. Link to comment https://forums.phpfreaks.com/topic/44412-php-returning-value-while-still-executing-code/ Share on other sites More sharing options...
per1os Posted March 26, 2007 Share Posted March 26, 2007 I have never heard of anyone needing this/using this. I am sure there is a way, maybe. But yea thats the glorious part about PHP, it is completely different than ASP =) Thank heavens! EDIT: I am taking it this is not what you are looking for: <?php print "test"; myFunction(); ?> As the browser is still waiting for a response. Yet another EDIT: http://us3.php.net/manual/en/features.connection-handling.php Maybe that is what you are looking for? Link to comment https://forums.phpfreaks.com/topic/44412-php-returning-value-while-still-executing-code/#findComment-215666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.