<?php declare (strict_types = 1); namespace app\command; use think\console\Command; use think\console\Input; use think\console\input\Argument; use think\console\input\Option; use think\console\Output; class Hello extends Command { protected function configure() { // 指令配置 $this->setName('hello') ->setDescription('the hello command'); } protected function execute(Input $input, Output $output) { // var_dump($input); // var_dump($output); $result=date("Y-m-d", strtotime("-1 month", strtotime("2017-03-31"))); // 指令输出 $output->writeln($result); } }