要实现您想要的功能,您需要在Module.php中使用它:
namespace Foo;
use Zend\ModuleManager\ModuleEvent;
use Zend\ModuleManager\ModuleManager;
class Module
{
public function init(ModuleManager $moduleManager)
{
$events = $moduleManager->getEventManager();
// Registering a listener at default priority, 1, which will trigger
// after the ConfigListener merges config.
$events->attach(ModuleEvent::EVENT_MERGE_CONFIG, array($this, 'onMergeConfig'));
}
public function onMergeConfig(ModuleEvent $e)
{
$configListener = $e->getConfigListener();
$config = $configListener->getMergedConfig(false);
// Modify the configuration; here, we'll remove a specific key:
if (isset($config['router']['routes']['your_route'])) {
unset($config['router']['routes']['your_route']);
}
// Pass the changed configuration back to the listener:
$configListener->setMergedConfig($config);
}
}
这只是一个例子.您需要将yout_route更改为表示/ user / list的数组部分.