Yii2.0 Predefined alias function Summary _php instance

Source: Internet
Author: User
Tags aliases smarty template yii

The examples in this article describe the Yii2.0 predefined aliases. Share to everyone for your reference, specific as follows:

To sum up, there are 12 default predefined aliases, including 11 path aliases, and URL aliases only @web 1:

@yii represents the directory where the Yii framework resides, and also the location of the Yii\baseyii class file;
@app represents the root directory of a running application, typically digpage.com/frontend;
The @vendor represents the directory of composer Third third-party, usually @app/vendor or @app/. /vendor;
The @bower represents the directory of Bower third Third-party, generally @vendor/bower;
@npm The directory of NPM's third third-party, usually @vendor/npm;
@runtime represents the directory where runtime files are stored at runtime for running applications, typically @app/runtime;
@webroot represents the directory in which the entry file for the running application index.php is located, generally @app/web;
@web A URL alias that represents the root URL of the current application, primarily for the front-end;
@common represents a generic folder;
@frontend represents the folder in which the foreground application resides;
@backend represents the folder in which the background application resides;
@console represents the folder where the command line application resides;

Other two-level aliases for YII extension registrations that use composer installation.

Thus, in the entire YII application, a specific path or URL can be easily and uniformly represented as long as the alias is used.

More about Yii related content readers can view the site topics: "Yii framework Introduction and common skills Summary", "PHP Excellent Development Framework Summary", "Smarty Template Primer Tutorial", "PHP date and Time usage summary", "PHP object-oriented Programming Program", " Summary of PHP string usage, Introduction to PHP+MYSQL database operations, and a summary of PHP common database operations Tips

I hope this article will help you with the PHP program design based on the YII framework.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.