Yii2 basic application
To set inside config file, write this inside $config array
'aliases' => [
'@name1' => 'path/to/path1',
'@name2' => 'path/to/path2',
],
Ref: http://www.yiiframework.com/doc-2.0/guide-structure-applications.html
But as mentioned here,
The @yii alias is defined when you include the Yii.php file in your entry script. The rest of the aliases are defined in the application constructor when applying the application configuration.
If you need to use predefined alias, write one component and link it in config bootstrap array
namespace appcomponents;
use Yii;
use yiiaseComponent;
class Aliases extends Component
{
public function init()
{
Yii::setAlias('@editor_lang_dir', Yii::getAlias('@webroot').'/scripts/sceditor/languages/');
}
}
and inside config file, add 'appcomponentsAliases' to bootstrap array
'bootstrap' => [
'log',
'appcomponentsAliases',
],
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…