Zend framework2 Zend 2:如何覆盖模块';谁的配置文件?

Zend framework2 Zend 2:如何覆盖模块';谁的配置文件?,zend-framework2,Zend Framework2,如何覆盖在./vendor/../module_name/config/module.config.php下找到的配置文件 不,这对我不起作用。我不知道为什么。尝试命名配置文件filename.global.php或filename.local.php 在application.config.php中,它有以下行: config/autoload/{,*.}{global,local}.php 关于ZfcUser模块和更改主路线。 在zfcuser.global.php中,修改文件底部的以下内

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


不,这对我不起作用。我不知道为什么。

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

在application.config.php中,它有以下行:

config/autoload/{,*.}{global,local}.php
关于ZfcUser模块和更改主路线。

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

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',
                    ),
                ),
            )
        )
    )
);

“模块进行修改”是什么意思?我的任何模块都没有覆盖配置-我只想在更改模块的配置中更改路由。在查看您提供的链接后,我已调整了答案。配置加载器似乎没有提取文章中使用的文件名。我在./config/autoload中已经有一个名为zfcuser.global.php的文件。也许我应该在那里编辑配置?(我以前更改过模块的某些部分)我个人会创建一个包含DI路由更改的新文件,但在解决问题的同时,您可以只修改现有文件,并且可能值得输出合并的配置以查看应用了哪些更改。这通常可以通过模块引导功能完成–当然,在ZF2的更高版本中,您可以从ServiceManager获得它。编辑zfcUser module.config.php或在您的模块中覆盖特定的数组条目。这是基本的PHP。检查“/user”并将其替换为“/member”相当标准;)