Cache.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\admin\controller\setting;
  13. use think\response\Json;
  14. use app\admin\controller\Controller;
  15. use app\admin\service\Cache as CacheService;
  16. /**
  17. * 清理缓存
  18. * Class Index
  19. * @package app\admin\controller
  20. */
  21. class Cache extends Controller
  22. {
  23. /**
  24. * 清理缓存
  25. * @return Json
  26. */
  27. public function clear(): Json
  28. {
  29. // 清理缓存
  30. $CacheService = new CacheService;
  31. if (!$CacheService->rmCache($this->postForm())) {
  32. return $this->renderError($CacheService->getError() ?: '操作失败');
  33. }
  34. return $this->renderSuccess('操作成功');
  35. }
  36. }