Get self web content
I have a php that makes some maintenance operations in my web and I need that the last operation it'll do is to save into a file the content of the screen. I mean, self content. If the scr开发者_如何学JAVAeen shows: "OP1 - OK ..." it has to save into a file this: "OP1 - OK ...".
Saving all the results of my operations into a variable will very hard for me. That's why I need to get the content of the self screen.
Is there any way to do this?
I think you can use an output buffer.
The following is from ob_start's php manual page:
This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.
The contents of this internal buffer may be copied into a string variable using ob_get_contents(). To output what is stored in the internal buffer, use ob_end_flush(). Alternatively, ob_end_clean() will silently discard the buffer contents.
精彩评论