Compress html output from zend framework 2
问题 I'm currently using Zend Framework 2 beta for on PHP 5.4.4 to develop a personal webapp for self-study purpose. I was wondering if it is possible to intercept the html output just before it is sent to the browser in order to minify it by removing all unnecessary white spaces. How could I achieve this result in ZF2? 回答1: Yep, you can: On Modle.php create an event that will trigger on finish public function onBootstrap(Event $e) { $app = $e->getTarget(); $app->getEventManager()->attach('finish'