第七节视频:框架
CI框架学习-实例操做利用AR类对栏目进行查、删、改动做函数
取cid的方法:学习
$cid = $this->uri->segment(4);//取第4个片断;this
/*查询对应栏目*/视频
public function check_cate($cid){ci
$data = $this -> db ->where(array('cid' => $cid)) ->get('category') ->result_array();get
return $data;io
}function
/*修改栏目*/date
public function update_cate($cid,$data){
$this -> db ->update('category',$data,array('cid'=>$cid));
}
/*删除栏目*/
public function del(){
$cid = $this -> uri ->segment(4);
$this ->load ->model('category_model','cate');
$this ->cate ->del($cid);
}
/*构造函数*/
/*自动载入*/
public function _construct(){
parent::_construct();
$this ->load ->model('category_model','cate');
}