Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在yii cli操作中获取bash命令?_Php_Bash_Yii_Command Line Interface - Fatal编程技术网

Php 如何在yii cli操作中获取bash命令?

Php 如何在yii cli操作中获取bash命令?,php,bash,yii,command-line-interface,Php,Bash,Yii,Command Line Interface,以及调用我在操作中需要的命令: class RunCommand extends CConsoleCommand { public function actionIndex($site, array $filters = null) { //here i need the command } } 在yiic.php中,配置配置文件和框架的路径: php yiic run --site=index --filers=mobiles --filers=tvs 如果

以及调用我在操作中需要的命令:

class RunCommand extends CConsoleCommand
{
    public function actionIndex($site, array $filters = null)
   {
      //here i need the command
   }
}

在yiic.php中,配置配置文件和框架的路径:

php yiic run --site=index --filers=mobiles --filers=tvs
如果一切正常,只需运行命令,./yiic run-site=index-filers=mobiles-filers=tvs或php yiic.php run-site=index-filers=mobiles-filers=tvs

<?php

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

require_once($yiic);
class RunCommand extends CConsoleCommand
{
    public function run($args)
    {
      //here $args will have your params, just parse them:
      // $args[0] => --site=index, $args[1] => --filers=mobiles etc...
      //here i need the command
    }
}