HelloController.php 825 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\commands;
  8. use yii\console\Controller;
  9. use yii\console\ExitCode;
  10. /**
  11. * This command echoes the first argument that you have entered.
  12. *
  13. * This command is provided as an example for you to learn how to create console commands.
  14. *
  15. * @author Qiang Xue <qiang.xue@gmail.com>
  16. * @since 2.0
  17. */
  18. class HelloController extends Controller
  19. {
  20. /**
  21. * This command echoes what you have entered as the message.
  22. * @param string $message the message to be echoed.
  23. * @return int Exit code
  24. */
  25. public function actionIndex($message = 'hello world')
  26. {
  27. echo $message . "\n";
  28. return ExitCode::OK;
  29. }
  30. }