dpxua26604 2011-12-23 11:46
浏览 44
已采纳

Yii文档生成器不接受docs命令

I want to use Yii document generator, i have extracted the source in protected/commands.

When I try to run the command:

yiic docs check

it says:

Yii command runner (based on Yii v1.1.8)
Usage: c:\wamp\www\FRAMEW~1\yiic <command-name> [parameters...]

The following commands are available:
 - message
 - migrate
 - shell
 - webapp

To see individual command help, use the following:
   c:\wamp\www\FRAMEW~1\yiic help <command-name>

Do I need to edit any config to run docs command ?

  • 写回答

1条回答 默认 最新

  • dsdsds12222 2011-12-29 02:03
    关注

    You can add a Command to your CConsoleApplication by adding it to the commandMap. add this to your protected/config/console.php:

    'commandMap' => array(
         'docs' => array(
            // alias of the path where you extracted the DocsCommand.php
            'class' => 'application.commands.DocsCommand',
          )
    ),
    

    after that yiic docs will run DocsCommand and it also should appear in the list of available commands.

    You have to do this in your console application config since CWebapplication and CConsoleApplication have many different properties you can set via config. commandMap in this example is a property of CConsoleApplication but not of CWebApplication so you can only define it in console app. Read more about configuration in Yii's Definitive Guide

    Also if you have a look at the yiic.php in your applications protected path you will see it includes the console.php file:

    <?php
    
    // change the following paths if necessary
    $yiic=dirname(__FILE__).'/../yii/framework/yiic.php';
    $config=dirname(__FILE__).'/config/console.php';
    
    require_once($yiic);
    

    If you have configuration that should be the same for web and console, for example a database connection, you can put that into an own config file e.g. config/db.php and include it in both config/main.php and config/console.php like this:

    'db' => include(dirname(__FILE__). '/db.php'),
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 关于php中URL传递GET全局变量的问题
  • ¥15 怎么改成循环输入删除(语言-c语言)
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误
  • ¥100 当AWR1843发送完设置的固定帧后,如何使其再发送第一次的帧
  • ¥15 图示五个参数的模型校正是用什么方法做出来的。如何建立其他模型
  • ¥100 描述一下元器件的基本功能,pcba板的基本原理
  • ¥15 STM32无法向设备写入固件