Yii2.0 pre-defined alias function summary, yii2.0 alias Summary
This example describes the predefined alias Yii2.0. We will share this with you for your reference. The details are as follows:
Here, we will summarize that by default, there are a total of 12 pre-defined aliases, including 11 path aliases and only one URL alias @ web:
@ YiiIndicates the directory where the Yii framework is located and the location where the yii \ BaseYii files are located;
@ AppIndicates the root directory of the running application, which is generally digpage.com/frontend;
@ VendorIndicates the directory where the Composer third-party library is located, generally @ app/vendor or @ app/../vendor;
@ BowerIndicates the directory where the third-party library of Bower is located, which is generally @ vender/bower;
@ NpmIndicates the directory where the NPM third-party library is located, generally @ vendor/npm;
@ RuntimeIndicates the directory where the running application is used to store the running files, which is generally @ app/runtime;
@ WebrootIndicates the directory where index. php is located in the entry file of the running application, which is generally @ app/web;
@ WebURL alias, indicating the root URL of the current application, mainly used for the front-end;
@ CommonIndicates a common folder;
@ FrontendThe folder where the foreground application is located;
@ BackendThe folder where the background application is located;
@ ConsoleThe folder where the command line application is located;
Other secondary aliases registered by Yii extension installed using Composer.
In this way, the preceding alias can be used throughout the Yii application to conveniently and uniformly represent a specific path or URL.