zoukankan      html  css  js  c++  java
  • wuzhi 五指 数据库仿 thinkphp

    在/coreframe/app/模块/libs/class/mydb.class.php 中编辑

    调用 : $mydb = load_class("mydb","模块");  

    $mydb->begin()->save("表名","数据array类型");

    <?php
    // +----------------------------------------------------------------------
    // | wuzhicms [ 五指互联网站内容管理系统 ]
    // | Copyright (c) 2014-2015 http://www.wuzhicms.com All rights reserved.
    // | Licensed ( http://www.wuzhicms.com/licenses/ )
    // | Author: tuzwu <tuzwu@qq.com>
    // +----------------------------------------------------------------------
    defined('IN_WZ') or exit('No direct script access allowed');
    
    class WUZHI_mydb {
    
        private $db ;
        private $where ='';
        private $from =0;
        private $count =200;
        private $order ='';
        public function __construct() {
            $this->db = load_class("db");
    
        }
    
        public function begin()
        {
            $this->where = '';
            $this->order = '';
            $this->from = 0;
            $this->count = 200;
            return $this ;
    
        }
    
        public function where($c)
        {
            $this->where = $c ;
            return $this ;
        }
        public function order($c)
        {
            $this->order = $c ;
            return $this ;
        }
        public function page($from,$count)
        {
            $this->from = $from ;
            $this->count = $count ;
            return $this ;
        }
    
        public function getall($table){
    
            return $this->db->get_list($table,$this->where,'*',0,$this->count,$this->from,$this->order);
    
        }
        public function getbyid($table,$id){
            
    
            return $this->db->get_one($table,$id);
    
        }
    
        public function save($table,$c)
        {
            $this->db->update($table, $c, $this->where);
        }
        public function add($table,$c)
        {
            $this->db->insert($table, $c);
        }
        public function delete($table,$c)
        {
            $this->db->delete($table, $c);
        }
    
    
    
    
    
    
    
    }
  • 相关阅读:
    将一个dropdownlist从一个div复制到另一个div
    【转】AOP 那点事儿(续集)
    【转】AOP 那点事儿
    spring 简单配置
    spring 基础原理
    jvm简介
    jre、jdk和jvm的关系
    【转】Jvm工作原理
    servlet简述
    Filter简述
  • 原文地址:https://www.cnblogs.com/aliblogs/p/5665939.html
Copyright © 2011-2022 走看看