nguyendh
(Duynguyen0511)
1
Yii2 console application needs to work with Yii::getAlias(’@webroot’). I get ‘Invalid path alias: @webroot’
Looks like I can manually set "aliases" for console application.
Any ideas which files and how do I set aliases for Yii2 console application ?
Thanks
maybe you could use ‘@app/web’
1 Like
Use this on your controller to set the alias
public function init()
{
Yii::setAlias('@webroot', realpath(dirname(__FILE__).'/../'));
parent::init();
}
so Yii::getAlias(’@webroot’) will work