data = $data; } /** * Execute the job. * * @return void */ public function handle() { try{ if(is_array($this->data) || is_object($this->data)){ $data = json_encode($this->data); }else { $data = $this->data; } file_put_contents('send_man.txt',date('Y-m-d H:i:s').PHP_EOL . $data . PHP_EOL,8); //输出信息 测试 $this->echoMessage(new ConsoleOutput()); }catch (\Exception $exception){ file_put_contents('send_man_error.txt',date("Y-m-d H:i:s").PHP_EOL.$exception->getMessage().PHP_EOL,8); } } protected function echoMessage(OutputInterface $output) { $output->writeln($this->data); } }