Home > php教程 > PHP开发 > Yii (yiiframework) framework (2): Build the first Yii application

Yii (yiiframework) framework (2): Build the first Yii application

黄舟
Release: 2016-12-27 10:53:43
Original
1221 people have browsed it

The yii framework has been installed before, now let’s create the first Yii application

1. Enter the directory of your website

2. Execute the command: YiiRoot/framework/yiic webapp testdrive

Note: The YiiRoot here is the installation directory of your Yii framework.

3. After entering the above command, a prompt message will appear:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/php_pdo_mysql.dll' - 
/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/php_pdo_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Create a Web application under '/home/wwwroot/test.yii.com/'? (yes|no) [no]:
Copy after login

Here it prompts whether to install the web application in this directory. We can directly enter yes to complete. Application creation.

4. Visit your application: http://hostname/index.php. We can see an application that includes a homepage, about page, contact page, and login page.

Yii (yiiframework) framework (2): Build the first Yii application

5. Introduction to the application directory structure:

|-- assets contains public resource files
|-- css contains CSS files
| |-- bg.gif
| |-- form.css
| |-- ie.css
| |-- main.css
| |-- print.css
| `-- screen.css
|-- images Contains image files
|-- index-test.php Entry script file used for functional testing
|-- index.php Web application entrance Script file
|-- protected Contains protected application files
| |-- commands Contains customized 'yiic' commands
| | `-- shell Contains customized 'yiic shell' commands
| |-- components Contains reusable user components| | |-- Controller.php The base class for all controller classes
| | `-- UserIdentity.php The 'Identity' class used for authentication
| |-- config contains configuration files
| | |-- console.php console application configuration
| | |-- main.php Web application configuration
| | `-- test.php functional test Configuration used
| |-- controllers Contains the class file of the controller
| | `-- SiteController.php The class file of the default controller
| |-- data Contains the sample database| | |-- schema.mysql.sql Sample MySQL database
| | |-- schema.sqlite.sql Sample SQLite database
| | `-- testdrive.db Sample SQLite database file
| |-- extensions include third parties Extensions
| |-- messages Contains translated messages
| |-- migrations
| |-- models Class files containing models
| | |-- ContactForm.php 'contact' action form model
| | `-- LoginForm.php 'login' action form model
| |-- runtime contains temporarily generated files
| |-- tests contains test scripts
| | |-- WebTestCase.php
| | |-- bootstrap.php
| | |-- fixtures
| | |-- functional
| | | | `-- SiteTest.php
| | |-- phpunit.xml
| | |-- report
| | `-- unit
| |-- views View and layout files containing controllers
| | |-- layouts contains the layout view file
| | | | |-- column1.php uses the layout used for the single-column page
| | | -- main.php Default layout for all views
| | `-- site View file containing the 'site' controller
| | | -- contact.php 'contact' action view
| | |-- error.php 'error' action view (display external errors)
| | | |-- index.php 'index' action view
| | |-- login.php 'login' action view View
| | `-- pages contains "static" pages
| | `-- about.php "about" page's view
| |-- yiic yiic command line script
| |- - yiic.bat yiic command line script under Windows
| `-- yiic.php yiic command line PHP script
`-- themes Contains application themes
`-- classic
`-- views
                                                                                                                                                                 For more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template