How can I see exactly what PHP output to the client?
I'm creating a PHP backend for an iPhone app. I use PHP to generate xml for the client. When there's a problem I'd like to see exactly what was sent to the client app, without having access to a user's device.
Instead of using echo
to output to the client I've tried building all the output in a string and then as a last step using echo to output the string. That way I can also save that output string to a file for debugging. But when there are parse errors an开发者_JS百科d such, the script generates a different output than what is saved in my $output string.
What low-level function can I use to save the exact output to the client, in a file on the server?
Add it before script execution
ob_start(function($text){
//log $text;
return $text;
});
精彩评论