Home >PHP Framework >YII >How to create applications in yii framework

How to create applications in yii framework

(*-*)浩
(*-*)浩Original
2019-12-30 09:31:222296browse

How to create applications in yii framework

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

How to create applications in yii framework

Contact Page

How to create applications in yii framework

Login Page

How to create applications in yii framework

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use module in yii2Next article:How to use module in yii2