dsaj20411 2011-01-09 22:57
浏览 27
已采纳

如何对Zend的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 be interpreted?

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • douben8492 2011-01-09 23:02
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了