Hello.php 663 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\command;
  4. use think\console\Command;
  5. use think\console\Input;
  6. use think\console\input\Argument;
  7. use think\console\input\Option;
  8. use think\console\Output;
  9. class Hello extends Command
  10. {
  11. protected function configure()
  12. {
  13. // 指令配置
  14. $this->setName('hello')
  15. ->setDescription('the hello command');
  16. }
  17. protected function execute(Input $input, Output $output)
  18. {
  19. // var_dump($input);
  20. // var_dump($output);
  21. $result=date("Y-m-d", strtotime("-1 month", strtotime("2017-03-31")));
  22. // 指令输出
  23. $output->writeln($result);
  24. }
  25. }