Yii provides powerful command line tools to quickly create related components and applications.
The following describes how to quickly create a yii application using yiic.
My web directory is under D: \ www, and yiiframework under D: \ www \ yii \ framework
Go to the www \ yii \ framework directory on the win platform CD
Run the CMD command
C: \ Users \ ******> D:
* [Switch to disk D]
D: \> Cd www \ yii \ framework
D: \ www \ yii \ framework> yiic webapp ../testapp/
* Create a testapp in the upper-level directory of the framework. Press enter]
Create a web application under 'd: \ www \ yii \ testapp '? [Yes | no] y
* [Select y/Yes and press enter]
Mkdir D:/www/yii/testapp
Mkdir D:/www/yii/testapp/assets
Mkdir D:/www/yii/testapp/CSS
Generate CSS/bg.gif
Generate CSS/form.css
Generate CSS/ie.css
Generate CSS/main.css
Generate CSS/print.css
Generate CSS/screen.css
Mkdir D:/www/yii/testapp/Images
Generate index-test.php
Generate index. php
Mkdir D:/www/yii/testapp/protected
Generate protected/. htaccess
Mkdir D:/www/yii/testapp/protected/commands
Mkdir D:/www/yii/testapp/protected/commands/Shell
Mkdir D:/www/yii/testapp/protected/components
Generate protected/components/controller. php
Generate protected/components/useridentity. php
Mkdir D:/www/yii/testapp/protected/config
Generate protected/config/console. php
Generate protected/config/Main. php
Generate protected/config/test. php
Mkdir D:/www/yii/testapp/protected/Controllers
Generate protected/controllers/sitecontroller. php
Mkdir D:/www/yii/testapp/protected/Data
Generate protected/data/Schema. MySQL. SQL
Generate protected/data/Schema. SQLite. SQL
Generate protected/data/testdrive. DB
Mkdir D:/www/yii/testapp/protected/extensions
Mkdir D:/www/yii/testapp/protected/messages
Mkdir D:/www/yii/testapp/protected/migrations
Mkdir D:/www/yii/testapp/protected/models
Generate protected/models/contactform. php
Generate protected/models/loginform. php
Mkdir D:/www/yii/testapp/protected/Runtime
Mkdir D:/www/yii/testapp/protected/Tests
Generate protected/tests/Bootstrap. php
Mkdir D:/www/yii/testapp/protected/tests/fixtures
Mkdir D:/www/yii/testapp/protected/tests/functional
Generate protected/tests/functional/sitetest. php
Generate protected/tests/phpunit. xml
Mkdir D:/www/yii/testapp/protected/tests/Report
Mkdir D:/www/yii/testapp/protected/tests/Unit
Generate protected/tests/webtestcase. php
Mkdir D:/www/yii/testapp/protected/Views
Mkdir D:/www/yii/testapp/protected/views/layouts
Generate protected/views/layouts/column1.php
Generate protected/views/layouts/column2.php
Generate protected/views/layouts/Main. php
Mkdir D:/www/yii/testapp/protected/views/Site
Generate protected/views/site/contact. php
Generate protected/views/site/error. php
Generate protected/views/site/index. php
Generate protected/views/site/login. php
Mkdir D:/www/yii/testapp/protected/views/site/pages
Generate protected/views/site/pages/about. php
Generate protected/yiic
Generate protected/yiic. bat
Generate protected/yiic. php
Mkdir D:/www/yii/testapp/themes
Mkdir D:/www/yii/testapp/themes/classic
Mkdir D:/www/yii/testapp/themes/classic/Views
Generate themes/classic/views/. htaccess
Mkdir D:/www/yii/testapp/themes/classic/views/layouts
Mkdir D:/www/yii/testapp/themes/classic/views/Site
Mkdir D:/www/yii/testapp/themes/classic/views/System
Your application has been created successfully under
Now, yii has created a new application.
Friends who use win + Wamp may encounter the following problems:
When executing the yiic webapp command, the following error is reported: '"php.exe"' is not an internal or external command, or a program or batch file that can be run.
In this case, the yiicbatch processing program cannot find php.exe.
Method 1: Modify the yiic. BAT file
Open the yii Installation Directory D:/www/yii/framework/yiic. bat, and yiic. bat has a notepad to open the following line:
If "% php_command %" = "" set php_command#php.exe
Since php.exe was not added to Windows environment variables during wampinstallation, it is no wonder that yiic cannot be found. In this example, you only need to assign the absolute path of php.exe to php_command. In my environment, the settings are as follows:
If "% php_command %" = "" set php_command = D: \ Wamp \ PHP \ php.exe
Method 2: Add PHP and yii framework to Environment Variables
Right-click my computer and choose Properties.