Yii2 module 加载配置初始化模块,配置类似应用主体配置无法生效 [ 2.0 版本 ]
文档中是这么写的:
如果 init() 方法包含很多初始化模块属性代码, 可将他们保存在配置 并在 init() 中使用以下代码加载:
public function init()
{
parent::init();
// 从config.php 加载配置来初始化模块
\Yii::configure($this, require __DIR__ . '/config.php');
}
config.php 配置文件可能包含以下内容,类似 应用主体配置。
<?php
return [
'components' => [
// list of component configurations
],
'params' => [
// list of parameters
],
];
这个无法生效啊,求大腿告知正确姿势~~
共 0 个回答
没有找到数据。
mydzoo
注册时间:2017-01-05
最后登录:2022-03-29
在线时长:53小时40分
最后登录:2022-03-29
在线时长:53小时40分
- 粉丝4
- 金钱2075
- 威望10
- 积分2705