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
}
}