php - Configuring zend module to use finish -


i'm trying configure finish function module.php in zend, understand need configure sort of listener (in bootstrap think) call finish function , can execute code after finished user request.

can provide example code setup module call finish once has finished user request.

thanks!

you can in onbootstrap method of module.php following:

public function onbootstrap(mvcevent $e) {     $em = $e->getapplication()->geteventmanager();     $em->attach(\zend\mvc\mvcevent::event_finish, array($this, 'dosomething')); } 

and define function dosomething in module.php following:

public function dosomething(mvcevent $e) {     // code goes here } 

you can add priority callback functions want execute if attached more 1 listener on same event following:

$em->attach(\zend\mvc\mvcevent::event_finish, array($this, 'dosomethingfirst'), 20); $em->attach(\zend\mvc\mvcevent::event_finish, array($this, 'doanotherthinglater'), 10); 

higher priority values execute earliest. (default priority 1, , negative priorities allowed.)


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -