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);
} }
wuzhi 五指 数据库仿 thinkphp的更多相关文章
- php 仿thinkphp的sql类库
模仿thinkphp封装的类库 <?php /** * MySql操作类2015版 * 作者:咖啡兽兽 287962566@qq.com * 使用说明: * //包含文件 * inclode ' ...
- wuzhi 五指 基本知识
参数:m 模块 在于 /coreframe/app/模块文件夹 |默认 content f php文件 控制器 在于/coreframe/app/模块 /文件.php | 默认 index v ...
- wuzhi 五指 伪静态
rewrite ^(.*)list\/([0-9]+)-([0-9]+)\.html$ $1index.php?v=listing&cid=$2&page=$3 last; rewri ...
- Thinkphp框架回顾(三)之怎么实现平常的sql操作数据库
1.首先简单介绍一下我们的数据库,thinkphp数据库下有一个tp_user表,然后有四个字段....id,username,password,sex 我们今天的任务就是在Thinkphp下将数据调 ...
- ThinkPHP中连接mysql数据库的四种实用和通用的连接方法
ThinkPHP内置了抽象数据库访问层,把不同的数据库操作封装起来,我们只需要使用公共的Db类进行操作,而无需针对不同的数据库写不同的代码和底层实现,Db类会自动调用相应的数据库适配器来处理.目前的数 ...
- thinkphp链接多个数据库时怎么调用M方法?
老项目tp3.1.3,有N个数据库,thinkphp好久没用了,不知道怎么用M方法了,代码测验成功! 数据库名称: 2.直接上代码 $custom = M('base','branch_','shop ...
- 一个类似ThinkPHP的Node.js框架——QuickNode
QuickNode Node.js从QuickNode开始,让restful接口开发更简单! PHP的MVC 作为一名曾经的PHP开发者,我也有过三年多的thinkphp使用经验,那是我学习PHP接触 ...
- Thinkphp 学习笔记
前后台配置: 在根目录文件夹中创建一个Conf文件夹 Conf文件夹下建立一个config.php文件,里面存放公共配置信息,方便前后台调用. 简单定义404页面 伪静态去除.html Config中 ...
- ThinkPHP 3.2.3 简单后台模块开发(一)常用配置
一.项目分组 下载解压 ThinkPHP 3.2.3,在默认的应用 Application(./Application) 中,包含一个默认的模块 Home(./Application/Home). 需 ...
随机推荐
- CODE[VS]-保留两位小数-浮点数处理-天梯青铜
题目描述 Description 保留两位小数输出一个浮点数. 输入描述 Input Description 一个浮点数.double范围内 输出描述 Output Description 保留两位小 ...
- jsp中使用java函数
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> ${fn ...
- JUnit——(一)使用IDEA进行基本操作
JUnit是一个回归测试框架(regression testing framework).Junit测试是程序员测试,即所谓白盒测试,因为程序员知道被测试的软件如何(How)完成功能和完成什么样(Wh ...
- odoo 获取当前会计年度
odoo 获取当前会计年度 def default_fiscal_year(self): current_period = self.env['account.fiscalyear'].find() ...
- openwrt 添加 应用(luci-application)
openwrt 添加应用的几个步骤如下: (1)在目录 ./feeds/luci/applications 下添加要增加的应用,譬如 "luci-test" (2)里面应该包含以下 ...
- GoogleCodeJam
2016年没有参赛,在师兄的介绍下,试了一下简单的一题,需要注意的是读写数据的形式还有具体代码. 2016资格赛 A题 Problem Bleatrix Trotter the sheep has d ...
- python 之 批量替换文件中文本后缀
代码示例如下: #!/usr/local/bin python import os def swapextensions(dir, before, after): if before[:1] != ' ...
- python 之调用Linux shell命令及相关高级应用
最近根据老大要求,将数据进行同步备份,结合第三方提供的工具.第三方服务其实是有python demo的,本想研究下实际的python sdk搞个demo开发的,但是发现有些组建装起来确实头大,而且本公 ...
- Python基础(六)-内置函数
map().filter().reduce() map(func,iterator) --> filter(func,iterator) --> reduce(func,iterato ...
- textview设置不同字体大小
<style name="style0"> <item name="android:textSize">19dip</item&g ...