开发者

How can I see exactly what PHP output to the client?

开发者 https://www.devze.com 2023-03-24 07:31 出处:网络
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 use

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;
});
0

精彩评论

暂无评论...
验证码 换一张
取 消