本文介绍了Zend 2:如何覆盖模块的配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何覆盖 ./vendor/.../module_name/config/module.config.php 下的配置文件?

How can I override configuration files found under ./vendor/.../module_name/config/module.config.php?

不,这个链接不是't 为我工作.我不知道为什么.

And no, this link isn't working for me. I'm not sure why.

推荐答案

尝试将配置文件命名为 filename.global.php 或 filename.local.php.

Try naming the configuration file filename.global.php or filename.local.php.

在 application.config.php 里面有这行:

Inside application.config.php it has this line:

config/autoload/{,*.}{global,local}.php

关于 ZfcUser 模块和更改主路由.

zfcuser.global.php文件底部修改以下内容:

In zfcuser.global.php modify the following at the bottom of the file:

return array(
    'zfcuser' => $settings,
    'service_manager' => array(
        'aliases' => array(
            'zfcuser_zend_db_adapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Zend\Db\Adapter\Adapter',
        ),
    ),
    'router' => array(
        'routes' => array(
            'zfcuser' => array(
                'options' => array(
                    'route' => '/member',
                    'defaults' => array(
                        'controller' => 'zfcuser',
                        'action' => 'index',
                    ),
                ),
            )
        )
    )
);

这篇关于Zend 2:如何覆盖模块的配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 02:40