In order to have a preliminary understanding of Yii, let’s talk about how to build the first Yii application. We will use the powerful yiic tool, which is used to automatically generate various codes. Assume that YiiRoot is the installation directory of Yii. (Recommended learning:yii framework)
Run yiic on the command line, as shown below:
% YiiRoot/framework/yiic webapp WebRoot/testdrive
Note: On MacOS, Linux or Unix When running yiic in the system, you may need to modify the permissions of the yiic file to enable it to run. You can also use php YiiRoot/framework/yiic.php instead of yiic.
This will create a basic Yii application in the WebRoot/testdrive directory. WebRoot represents the root directory of your Web server. The application has all the necessary directories and files, so it's easy to add more functionality to it.
Without writing a line of code, we can access the following URL in the browser to take a look at our first Yii application:
http://hostname/testdrive/index.php
As we can see, this The application contains three pages: home page, contact page, and login page. The home page displays some information about the application and the user's login status, the contact page displays a contact form for users to fill out and submit their inquiries, and the login page allows users to first authenticate and then access authorized content.
Check out the screenshots below to learn more:
Homepage
Contact Page
Login Page
The above is the detailed content of How to create applications in yii framework. For more information, please follow other related articles on the PHP Chinese website!