|
本帖最后由 wuqian9871 于 2013-10-21 07:55 编辑
模型里写了这2个函数
PHP复制代码 function getlist ($diqu,$num,$offset){//首页地区分类
$query = $this->db->get_where('dili_u_m_mingxing', array('diqu' => $diqu),$num,$offset);
return $query->result_array();
} 复制代码PHP复制代码 function getpic ($diqu,$zhuangtai,$num,$offset){//首页地区图片
$query = $this->db->get_where('dili_u_m_mingxing', array('diqu' => $diqu,'zhuangtai'=>$zhuangtai),$num,$offset);
return $query->result_array();
} 复制代码
控制器里直接调用模型函数输出
PHP复制代码 public function index() {$this->output->cache(1);
$data['neidi']= $this->Get_mingxing->getlist(1,24,0);
$data['gangtai']= $this->Get_mingxing->getlist(2,24,0);
$data['rihan']= $this->Get_mingxing->getlist(3,24,0);
$data['oumei']= $this->Get_mingxing->getlist(4,24,0);
$data['neidipic']=$this->Get_mingxing->getpic(1,1,6,0);
$data['gangtaipic']=$this->Get_mingxing->getpic(2,1,6,0);
$data['rihanpic']=$this->Get_mingxing->getpic(3,1,6,0);
$data['oumeipic']=$this->Get_mingxing->getpic(4,1,6,0);
$data['zuhe']=$this->Get_mingxing->getzuhelist('组合',24,0);
$data['zuhepic']=$this->Get_mingxing->getzuhepic('组合',1,6,0);
$this->load->view('welcome_message',$data);
} 复制代码
实在是太慢,加入了缓存,也还是很慢 新手求解 是不是这样写不对啊?(数据库5000条数据)
|
|