ClearCache.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\command;
  12. use think\console\Command;
  13. use think\console\Input;
  14. use think\console\Output;
  15. use think\facade\Log;
  16. use crmeb\services\CacheService;
  17. use crmeb\services\FileService;
  18. class ClearCache extends Command
  19. {
  20. protected function configure()
  21. {
  22. // 指令配置
  23. $this->setName('clear:cache')
  24. ->setDescription('已删除缓存');
  25. }
  26. protected function execute(Input $input, Output $output)
  27. {
  28. try {
  29. FileService::delDir(root_path() . 'runtime');
  30. } catch (\Exception $e) {
  31. Log::info('删除缓存错误:' . $e->getMessage());
  32. }
  33. $output->info('执行成功:已删除缓存');
  34. }
  35. }