老大 请教下在业务代码中调用命令行 希望增加 类似 tp colsole::call() 和 laravel Artisan::call() 这样的方法

yzh52521

使用 业务代码中想调用webman命令行
想通过一个命令名执行

        $parameters  = '{}';
        $command     = ['command' => 'mail'];
        $input       = new ArrayInput(array_merge($command, json_decode($parameters, true)));
        $output      = new BufferedOutput();
        $application = new Application();
        $application->setAutoExit(false);
     //   $application->add(new \app\command\Email);
        $result = $application->run($input, $output);
        echo $result . PHP_EOL;
        dump($output->fetch());

这样是可以执行 但是要设置添加
$application->add();
一步命令

怎么跳过这步代码?

812 1 0
1个回答

鲁达

我也想要这个call功能

  • 暂无评论
年代过于久远,无法发表回答
🔝