This article mainly introduces the PHP Ob_start and other functions to intercept the standard output of the relevant data, the need for friends can refer to the
Recently in the use of PHP under the CLI to develop a software, encountered such a problem. I wanted to collect the output from the PHP script, so I used the Ob_start and Ob_end_flush functions, and I did have the function of collecting output, but I also printed it into the console interface. What I want to ask is there is no way to block PHP like the console output information. The software is not allowed to print anything to the console in principle.
PHP-CLI itself from the Web server to execute the script, I do not know how you have access to the data is how to get it? If you do not get it by executing the value returned by the PHP program via the CLI, you can use the Ob_get_clean ()
He'll get the cached content and clear the buffer so that you can achieve what you say does not appear to the display interface
Of course you can also get the buffer content, then empty (control not output to the console), and then falsh the content to the Web server for processing
It's done in accordance with the above method. Before the function of this series has been used, too long not to, some forget.
Now doing is a PHP based multi-process HTTP dynamic server. Graduation thesis, test product, nothing practical.
PHP-CGI program execution result is the standard input output, so can only use to obtain the standard input output way to intercept the output result, the pipeline should also be possible, but I will not
The above mentioned is the entire content of this article, I hope you can enjoy.