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);
        }
    
    
    
    
    
    
    
    }
  • 相关阅读:
    MD5 带salt 加密
    生成包含数字和大小写字母的随机码
    多读好代码助于提高
    Winform程序窗体间的跳转
    Sql Server 存储过程
    GDI+的学习
    管理人生的8个危机
    马云语录
    无边框窗体的拖动和拉伸
    安装oracle时遇到 环境变量path的值超过1023字符,无法设置该值
  • 原文地址:https://www.cnblogs.com/aliblogs/p/5665939.html
Copyright © 2011-2022 走看看