开发者

How do I flush the Zend Output buffer at the Controller stage?

I have a Zend Controller that serves files to users.

I have used Noginn SendFile action helper to do the actual streaming of the file, but the code simply uses readfile($path) to place the content of the file into the buffer after setting the MIME, Content-Type, etc.

The problem is that the file that arrives down the pipe has an extra blank byt开发者_StackOverflow中文版e 0x20 at the beginning, not a train smash for text files but obviously fatal for images

My controller has the following code in it to stop any view scripts from being rendered:

$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();

but I think a whitespace is still getting placed in the output buffer somewhere before the file is getting streamed. Is there a way to clear the output buffer before I stream the file?

Thanks is advance.


The answer is painfully obvious, now that I have had some coffee

ob_clean();

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜