Example #1
0
 /**
  * 显示列表页面
  */
 public function index()
 {
     $wheres = array();
     $keyword = I('get.keyword');
     if (!empty($keyword)) {
         $wheres['name'] = array('like', "%{$keyword}%");
     }
     //使用模型中的getPageResult方法
     $rows = $this->model->getPageResult($wheres);
     //分配变量到页面
     $this->assign($rows);
     $this->assign('meta_title', $this->meta_title);
     //获取请求URL保存到Cookie里面,后面好使用
     cookie('__forward__', $_SERVER['REQUEST_URI']);
     //显示视图
     $this->display('index');
 }