Yii authoritative guide-start (1/8)

Source: Internet
Author: User


What is yii?

Yii is a component-based high-performance PHP framework for rapid development of large web applications. It maximizes the reusability in web development and significantly improves your web application development speed. YiiYi (YEE)Or[ji:]) RepresentativeEasy),Efficient)AndExtensible).

Environment requirements

To run a yii-driven web application, you need a web server that supports PHP 5.1.0 or later.

For developers who intend to use yii, It is very helpful to understand Object-Oriented Programming (OOP. Yii is a pure OOP framework.

What is yii most suitable?

Yii is a general web programming framework that can be used to develop almost all web applications. Because it is lightweight and has mature cache solutions, it is especially suitable for developing high-traffic applications, such as portals, forums, content management systems (CMS), e-commerce systems, and so on.

What is the comparison between yii and other frameworks?

Similar to most PHP frameworks, yii is an MVC framework.

Yii wins other frameworks with its excellent performance, rich functions and clear documentation. Yii was carefully designed from the very beginning to adapt to strictly prohibited web application development. It is neither a derivative of other projects nor a combination of third-party work. It is the result of the author's rich web application development experience and research and Thinking on most popular Web programming frameworks and applications.


The installation of yii consists of the following two steps:

  1. Download the yii framework from yiiframework.com.
  2. Decompress the yii package to a web-accessible directory.

Tip | tip: installation in the web directory is not required. Each yii application has an entry script, which must be exposed to Web users only. Other PHP scripts (including yii) should be protected against web access because they may be exploited by hackers.


After installing yii, you may want to verify whether your server meets the requirements for using yii. You only need to enter the following URL in your browser to access the requirement detection script:

~~~ Http: // hostname/path/to/yii/requirements/index. php ~~~

The minimum requirement of yii is that your web server supports PHP 5.1.0 or later. Yii has passed the test on Apache HTTP Server on Windows and Linux systems. It should also work properly on other web servers and platforms that support PHP 5.

Create the first yii Application

To have a preliminary understanding of yii, we will describe how to build the first yii application in this section. We will useyiic(Command line tool) to create a new yii application.Gii(Powerful web-based code generator) automatically generates code for specific tasks. Assume thatYiiRootIs the installation directory of yii,WebRootIs the root directory of the server document.

Runyiic, As shown below:

~~~ % Yiiroot/framework/yiic webapp webroot/testdrive ~~~

Note | Note: Run in MacOS, Linux, or UnixyiicYou may need to modifyyiicFile Permission to run. You can also run this tool as follows:

~~~ % Cd webroot % PHP yiiroot/framework/yiic. php webapp testdrive ~~~

This will be inWebRoot/testdriveCreate a basic yii application under the directory. This application has the directory structure required by most yii applications.

Without writing a line of code, we can access the following URL in the browser to see our first yii application:

~~~ Http: // hostname/testdrive/index. php ~~~


Yii authoritative guide-start (1/8)

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.