特定のモジュール用のカスタム構成ファイルを作成する必要がある場合は、次のようにmodule/CustomModule/configフォルダーに追加の構成ファイルを作成できます。
module.config.php
module.customconfig.php
これは、module.customconfig.phpファイルの内容です。
return array(
'settings' => array(
'settingA' => 'foo',
'settingB' => 'bar',
),
);
次に、 CustomModule/module.phpファイルのgetConfig()メソッドを変更する必要があります。
public function getConfig() {
$config = array();
$configFiles = array(
include __DIR__ . '/config/module.config.php',
include __DIR__ . '/config/module.customconfig.php',
);
foreach ($configFiles as $file) {
$config = \Zend\Stdlib\ArrayUtils::merge($config, $file);
}
return $config;
}
次に、コントローラーでカスタム設定を使用できます。
$config = $this->getServiceLocator()->get('config');
$settings = $config["settings"];
それは私のための仕事であり、それがあなたを助けることを願っています.