开发者

How to do post-processing to headers/buffer in Zend's MVC?

So, I have created a Zend application following the quick start guide (so it has layouts, and heavy usage of application.ini configurations rather that hard-coded options) with a few changes here and there, but now I want to manipulate the output given to the browser... I've googled but it seems that I don't know how to search or more importantly what to search... I want to be able to do something like:

<?php

    ob_start();

    echo 'Hello ';
    echo 'World';
    echo '!';

    $buffer = ob_get_contents();
    ob_end_clean();

    echo my_own_function($buffer);

?>

And do some TIDY, comment/space removing, etc... I mean it isn't just that, I want to be able to do any post-processing on-the-fly. Also I wanna get my hands over the headers before are dispatched (I'm using php5.3) it is possible?

I mean which are the classes/methods that output headers and send text to the browser so it can开发者_StackOverflow be interpreted?

Thanks in advance.


for this purpose you can write a Zend_Controller plugin. See the documentation here: Zend Controller Plugins.

In your particular situation, you want to hook on the dispatchLoopShutdown method.

How to write these plugins is described on the linked page.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜