我已经完成了以下指南: http://www.yiiframework.com/doc-2.0/guide-concept-events.html
但我在这里有一个简单的困惑:
//这个处理程序是一个静态类方法 $ foo-> on(Foo :: EVENT_HELLO,['app \ components \ Bar','methodName']);
上述事件将在执行方法时被触发:'app \ components \ Bar'的'methodName'?
OR
方法:类'app \ components \ Bar'的'methodName'将在上述事件的调用中触发?
答案 0 :(得分:0)
方法:' methodName'类&app;组件\栏\&39;将在上述事件的召唤下解雇。
要在执行方法时触发事件,您必须触发事件 - http://www.yiiframework.com/doc-2.0/guide-concept-events.html#triggering-events