1.cmd輸入(已經加入yii framework到環境變量)

yiic shell "e:\apache2\htdocs\test\index.php"
或

e:\apache2\htdocs\test\protected>yiic shell "e:\apache2\htdocs\test\index.php"
shell代碼或螢幕回顯 :

yii interactive tool v1.1
please type 'help' for help. type 'exit' to quit.
你目前顯示的是與shell互動的提示符。你可以輸入help檢視shell為你提供的所有指令清單

>> help
at the prompt, you may enter a php statement or one of the following commands:
- controller
- crud
- form
- help
- model
- module
type 'help <command-name>' for details about a command.
我們看了有幾個可選的指令,有一個controller指令看起來象是我們想要的,可能是用來為應用程式建立一個控制器的指令。我們可以在shell提标符下進一步了解controller指令的更多幫助資訊。這些資訊包括提供的用法說明,參數描述和一些例子。

>> help controller
usage
controller <controller-id> [action-id] ...
description
this command generates a controller and views associated with the specified actions.
parameters
* controller-id: required, controller id, e.g., 'post'.
if the controller should be located under a subdirectory,
please specify the controller id as 'path/to/controllerid',
e.g., 'admin/user'.
if the controller belongs to a module, please specify
the controller id as 'moduleid/controllerid' or
'moduleid/path/to/controller' (assuming the controller is under a subdirectory of that module).
* action-id: optional, action id. you may supply one or several action ids.
a default 'index' action will always be generated.
examples
* generates the 'post' controller:
controller post
* generates the 'post' controller with additional actions 'contact' and 'about':
controller post contact about
* generates the 'post' controller which should be located under
the 'admin' subdirectory of the base controller path:
controller admin/post
* generates the 'post' controller which should belong to the 'admin' module:
閱讀幫助,很明顯看出該指令會生成控制器和操作方法及視圖檔案。由于我們将要做的應用程式主要是顯示一條消息,讓我們調用controller message 和一個要顯示的操作方法:

>> controller message helloworld
generate messagecontroller.php
mkdir /webroot/demo/protected/views/message
generate helloworld.php
generate index.php
controller 'message' has been created in the following file:
/webroot/demo/protected/controllers/messagecontroller.php
you may access it in the browser using the following url:
http://hostname/path/to/index.php?r=message
>>
1.model

>> model user tbl_user
generate models/user.php
generate fixtures/tbl_user.php
generate unit/usertest.php
the following model classes are successfully generated:
user
if you have a 'db' database connection, you can test these models now with:
$model=user::model()->find();
print_r($model);
2. curd

>> crud user
generate usercontroller.php
generate usertest.php
mkdir d:/testdrive/protected/views/user
generate create.php
generate update.php
generate index.php
generate view.php
generate admin.php
generate _form.php
generate _view.php
crud 'user' has been successfully created. you may access it via:
3.module

>> module wiki
mkdir e:/apache2/htdocs/webapp/protected/modules
mkdir e:/apache2/htdocs/webapp/protected/modules/wiki
mkdir e:/apache2/htdocs/webapp/protected/modules/wiki/components
mkdir e:/apache2/htdocs/webapp/protected/modules/wiki/controllers
generate controllers/defaultcontroller.php
mkdir e:/apache2/htdocs/webapp/protected/modules/wiki/messages
mkdir e:/apache2/htdocs/webapp/protected/modules/wiki/models
mkdir e:/apache2/htdocs/webapp/protected/modules/wiki/views
mkdir e:/apache2/htdocs/webapp/protected/modules/wiki/views/default
generate views/default/index.php
mkdir e:/apache2/htdocs/webapp/protected/modules/wiki/views/layouts
generate wikimodule.php
module 'wiki' has been created under the following folder:
e:\apache2\htdocs\webapp\protected\modules\wiki
you may access it in the browser using the following url:
http://hostname/path/to/index.php?r=wiki
note, the module needs to be installed first by adding 'wiki'
to the 'modules' property in the application configuration.
4.