页面静态化

控制器:

 //页面静态化(缓存)
     public function behaviors()
     {
      return [
          [
              'class' => 'yii\filters\PageCache',
              'only' => ['list'],
              'duration' => 60,
              'variations' => [
                  \Yii::$app->language,
              ],
              'dependency' => [
                  'class' => 'yii\caching\DbDependency',
                  'sql' => 'SELECT COUNT(*) FROM yong',
              ],
          ],
      ];
     } 

posted on 2016-04-07 19:04  *孤独的夜行者*  阅读(146)  评论(0编辑  收藏  举报

导航