布莱克
public function actionIndex() { $this->view->title='外汇_外汇交易_外汇交易平台'; $cache_key='Cache_Index_All'; $data = Yii::$app->cache->get($cache_key); if(!$data){ $rows = WebAds::find()->where(['display' => '1'])->all(); $res = WebAnalystArticle::find()->orderBy('id desc')->limit(3)->all(); Yii::$app->cache->set($cache_key,['rows'=>$rows,'res'=>$res],7200); }else{ $rows=$data['rows']; $res=$data['res']; } return $this->render('index',['rows'=>$rows,'res'=> $res ]); }