Setting aliases in Yii2 within the app config file

后端 未结 4 777
孤独总比滥情好
孤独总比滥情好 2020-12-16 05:13

I\'m trying to set an alias in Yii2 but I\'m getting a Invalid Parameter / Invalid path alias for the below code that is placed in the

4条回答
  •  余生分开走
    2020-12-16 05:33

    To improve on @vitalik_74's answer

    you can place it in config/web.php instead(if you are using the basic yii app, I'm not sure about the main config file in the advance version, but the same applies, just put the require on the main config file) so that it gets shorten to:

    require(__DIR__ . '/aliases.php');
    

提交回复
热议问题