Created
July 3, 2012 07:47
-
-
Save Nully/3038328 to your computer and use it in GitHub Desktop.
ZF2のGlobalEventManagerの使い方例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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