lvhao hai 1 día
pai
achega
ad8cd1e846
Modificáronse 1 ficheiros con 24 adicións e 1 borrados
  1. 24 1
      core/CoreApp/controllers/Choice.php

+ 24 - 1
core/CoreApp/controllers/Choice.php

@@ -20,11 +20,34 @@ class Choice extends Start_Controller {
              $this->_Choice($arg);
         }
     }
+	// public function _Choice($arg)//查找重复
+	// {
+	// 	$this->data['arg'] = $arg;
+	// 	$this->_Template('choice',$this->data);
+	// }
+
 	public function _Choice($arg)//查找重复
 	{
+		$this->load->driver('cache');
+		$cache_key = 'choice_page_' . $arg;
+		$cached = $this->cache->get($cache_key);
+		if ($cached !== FALSE) {
+			echo $cached;
+			exit;
+		}
+
 		$this->data['arg'] = $arg;
-		$this->_Template('choice',$this->data);
+
+		ob_start();
+		$this->_Template('choice', $this->data);
+		$html = ob_get_clean();
+
+		$this->cache->save($cache_key, $html, 3600); // 缓存1小时
+
+		echo $html;
 	}
+
+
 	public function _Choices($arg){
 
 	}