As user2257808 said in his comment, onBootstrap is called before routing takes place, so there is not any RouteMatch to get. He suggested attaching to EVENT_RENDER, that may be too late in your case.
I would do something like this, attaching to MvcEvent::EVENT_DISPATCH
.
MyModuleModule.php
class Module {
public function onBootstrap(MvcEvent $e) {
$e->getApplication()->getEventManager()->attach(MvcEvent::EVENT_DISPATCH,
function($e){
var_dump($e->getRouteMatch());
exit;
}
);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…