Tuesday, 29 November 2016

PHP Output Buffering



What are the methods to turn on output buffering either within a PHP script or using and htaccess file?



I use the following method in an htaccess file in the root of my application:




php_value output_buffering On
php_value output_handler mb_output_handler


On one of my shared hosting accounts (linux hosting with PHP 5.2.x), the above yields a blank page. Tech support says they can't turn it on in the php.ini file but I can turn it on in my script...



ob_start() and ob_end_flush() also yields the same result. What can I do?


Answer



Use ob_start() and ob_end_flush().




ob_start() at the start of the script before any output (not even an empty space).



When u want to output use ob_end_flush().


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...