• 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);
        }
    
    
    
    
    
    
    
    }
  • 相关阅读:
    RK3399之时钟
    C之{}注意点
    ARM之不用段寄存猜想
    linux驱动之入口
    android之HAL
    git
    消息中间之ActiveMQ
    Maven之阿里云镜像仓库配置
    清理Oracle临时表空间
    Tomcat控制台日志输出到本地文件
  • 原文地址:https://www.cnblogs.com/aliblogs/p/5665939.html
Copyright © 2020-2023  润新知