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.
Install
The installation of yii consists of the following two steps:
- Download the yii framework from yiiframework.com.
- 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.
Requirement
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 thatYiiRoot
Is the installation directory of yii,WebRoot
Is the root directory of the server document.
Runyiic
, As shown below:
~~~ % Yiiroot/framework/yiic webapp webroot/testdrive ~~~
Note | Note: Run in MacOS, Linux, or Unixyiic
You may need to modifyyiic
File Permission to run. You can also run this tool as follows:
~~~ % Cd webroot % PHP yiiroot/framework/yiic. php webapp testdrive ~~~
This will be inWebRoot/testdrive
Create 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)