yii 框架bootstrap 启动失败

yii config 文件配置如下

相关代码

'bootstrap' => [

    'log',
    [
        'class' => 'app\components\Aliases',
        'aliases' => require(dirname(dirname(__DIR__)) . '/etc/aliases.' . YII_ENV . '.php'),
    ],
    'clcn',
    'bplisn',
],
'defaultRoute' => 'site',
'modules' => [
    'clcn' => [
        'class' => 'app\modules\clcn\Module',
    ],
    'bplisn' => [
        'class' => 'app\modules\bplisn\Module',
    ],
],

clcn Module代码如下

namespace app\modules\clcn;

use yii\base\BootstrapInterface;

/**
 * announcement module definition class
 */
class Module extends \yii\base\Module implements BootstrapInterface
{
    /**
     * @inheritdoc
     */
    public $controllerNamespace = 'app\modules\clcn\controllers';

    /**
     * @inheritdoc
     */
    public function init()
    {
        parent::init();

        // custom initialization code goes here
    }

    /**
     * {@inheritdoc}
     */
    public function bootstrap($app)
    {
        echo 1;die;
        if ($app instanceof \yii\web\Application) {
            $app->getUrlManager()->addRules([
                ['class' => 'yii\rest\UrlRule', 'controller' => 'clcn/event'],
                ['class' => 'yii\rest\UrlRule', 'controller' => 'clcn/announce'],
            ], false);
        }
    }


}

在最开始的config配置中boostrap加载了clcn 的ModuleID,但是不会进入到bootstrap方法中,正常情况下是可以进入到boostrap方法中吧,麻烦问一下,初始化的boostrap方法如何初始,我这么初始化有什么问题

阅读 1.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题