class ExampleController extends \yii\console\Controller{
// 命令 "yii example/create test" 会调用 "actionCreate('test')"
public function actionCreate($name) { ... }
// 命令 "yii example/index city" 会调用 "actionIndex('city', 'name')"
// 命令 "yii example/index city id" 会调用 "actionIndex('city', 'id')"
public function actionIndex($category, $order = 'name') { ... }
// 命令 "yii example/add test" 会调用 "actionAdd(['test'])"
// 命令 "yii example/add test1,test2" 会调用 "actionAdd(['test1', 'test2'])"
public function actionAdd(array $name) { ... }
}
调用命令传入参数 例子
参考 https://segmentfault.com/a/1190000005599365