yii使用yiic shell创建控制器

发表于:2018-11-02 10:50 阅读:

切换到项目目录,如demo,执行protected\yiic shell,效果如下:
D:\xampp\htdocs\demo>protected\yiic shell
Yii Interactive Tool v1.1 (based on Yii v1.1.13)
Please type 'help' for help. Type 'exit' to quit.
>> help controller
  controller <controller-ID> [action-ID] ...
  This command generates a controller and views associated with
  the specified actions.
 * 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.
 * 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 admin/post
NOTE: in the last two examples, the commands are the same, but
the generated controller file is located under different directories.
Yii is able to detect whether 'admin' refers to a module or a subdirectory.
>> controller post
   generate PostController.php
      mkdir D:/xampp/htdocs/demo/protected/views/post
   generate index.php
Controller 'post' has been created in the following file:
You may access it in the browser using the following URL: