MVC Model这么写是不是万事无忧 欢迎批评指正 谢谢

浏览:602 发布日期:2014/01/07 分类:技术分享 关键字: MVC
<?php
/**
 * Class TypeModel  这是一个操作分类表的数据模型
 */
class TypeModel extends Model{

    /**
     * 添加分类
     */
    public function addType($data){
        return $this->add($data);
    }

    /**
     * 所有分类
     */
    public function selectType($where=array(),$order='',$per=''){
        $where['status'] = array('neq','9');
        import('ORG.Util.Page');
        $count = $this->where($where)->count();
        $page = new Page($count,$per);
        $type['list'] = $this->where($where)->order($order)->limit($page->firstRow,$per)->select();
        $type['page'] = $page->show();
        return $type;
    }

    /**
     * 分类信息
     */
    public function findType($where=array()){
        $where['status'] = array('neq','9');
        return $this->where($where)->find();
    }

    /**
     *  修改分类
     */
    public function saveType($where=array(),$data){
        return $this->where($where)->save($data);
    }
}
最佳答案
评论() 相关
后面还有条评论,点击查看>>