選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ClearCache.php 708B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\command;
  3. use think\console\Command;
  4. use think\console\Input;
  5. use think\console\Output;
  6. use think\facade\Log;
  7. use crmeb\services\CacheService;
  8. use crmeb\services\FileService;
  9. class ClearCache extends Command
  10. {
  11. protected function configure()
  12. {
  13. // 指令配置
  14. $this->setName('clear:cache')
  15. ->setDescription('已删除缓存');
  16. }
  17. protected function execute(Input $input, Output $output)
  18. {
  19. try {
  20. FileService::delDir(root_path() . 'runtime');
  21. } catch (\Exception $e) {
  22. Log::info('删除缓存错误:' . $e->getMessage());
  23. }
  24. $output->info('执行成功:已删除缓存');
  25. }
  26. }