Skip to content

Instantly share code, notes, and snippets.

@Nully
Created July 3, 2012 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nully/3038328 to your computer and use it in GitHub Desktop.
Save Nully/3038328 to your computer and use it in GitHub Desktop.
ZF2のGlobalEventManagerの使い方例
<?php
namespace App;
use \Zend\EventManager\GlobalEventManager as GEM;
class IndexController extends ActionController
{
function indexAction()
{
// イベントを登録する
GEM::attach("dispatch", array( $this, "sayHello" ));
// イベントを発行する
GEM::trigger("dispatch");
}
function sayHello()
{
echo "Hello !";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment