1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2018/2/26/026
- * Time: 9:56
- */
- namespace backend\controllers;
- use backend\base\CommonController;
- use backend\base\Help;
- use Yii;
- class CacheController extends CommonController
- {
- // public $enableCsrfValidation = false;
- //2
- //3
- /*
- * 缓存清理页面 - 静态资源
- * */
- public function actionRes()
- {
- return $this->render('res');
- }
- /*
- * 静态资源缓存清理
- * */
- public function actionStaticcacheclear()
- {
- $cache = Yii::$app->cache;
- switch (Yii::$app->request->post('type')){
- case 1:
- $name = Yii::$app->params['resourceCacheKey']['mobile'];
- break;
- case 2:
- $name = Yii::$app->params['resourceCacheKey']['frontend'];
- break;
- case 3:
- $name = Yii::$app->params['resourceCacheKey']['backend'];
- break;
- default:
- return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error'));
- }
- if($cache->set($name,time()))
- {
- return Help::JsonCode(Help::SUCCESS,Yii::t('app','edit_success'));
- }
- return Help::JsonCode(Help::ERROR,Yii::t('app','edit_error'));
- }
- }
|