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);
        }
    
    
    
    
    
    
    
    }
  • 相关阅读:
    CSS
    HTML
    MySQL:PyMySQL&ORM
    MySQL:SQL进阶
    03-body标签中相关标签
    02-body标签中相关标签
    01-html介绍和head标签
    并发编程
    异常处理、网络编程
    面向对象进阶和模块
  • 原文地址:https://www.cnblogs.com/aliblogs/p/5665939.html
Copyright © 2011-2022 走看看