我怎樣才能引用從事件本身觸發beforeExecuteRoute的controllerName和actionName?phalconphp觸發事件的訪問控制器名稱
<?php
use Phalcon\Events\Manager as EventsManager;
//Create a events manager
$eventManager = new EventsManager();
//Listen all the application events
$eventManager->attach('micro', function($event, $app) {
if ($event->getType() == 'beforeExecuteRoute') {
//how to get controller name to handle acl stuff
}
});
我的問題依賴於$ app是Phalcon \ Mvc \ Micro的事實,所以我沒有Dispatcher,我可以通過$ app-> getRouter() - > getMatchedRoute()方法返回NULL,如http://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Router.html中所述,它也應該工作! – diegochaves