Code Monkey home page Code Monkey logo

gum's Introduction

概览

gum是基于php的开箱即用代码库。

数据库

// 链接数据库
$db = new db("table","password","root","127.0.0.1",3306);

// 查询一条记录
$row=$db->row("SELECT * FROM table");

// 查询记录集合
$rows=$db->rows("SELECT * FROM table");

// 查询记录总数
$count=$db->count("SELECT * FROM table");

// 插入
$db->insert("table",[
	"title" => "title",
	"content" => "content",
]);

// 获取新插入的自动编号id
$db->id();

// 更新
$db->update("table",[
	"title" => "title",
	"content" => "content",
],"id=1");

// 删除
$db->delete("table",[
	"title" => "title",
	"content" => "content",
],"id=1");

// 清空表数据
$db->clear(["table1","table2"]);

// 备份数据库导出sql语句
$db->export();

模型

参考demo-model.php

文件处理

发送e-mail

gum::mail([
	"to"       => "[email protected]",
	"subject"  => "test",
	"body"     => "test",
	"from"     => SMTP_MAIL,
	"server"   => SMTP_SERVER,
	"port"     => SMTP_PORT,
	"user"     => SMTP_USER,
	"password" => SMTP_PASSWORD,
]);

输出json

gum::json([
 "success"	=>	true,
]);

表单验证

参考demo-validate.php

格式化

  • 金额
echo format::rmb(12345);
  • 容量
echo format::size(1024);
  • 时间
echo format::ago($_SERVER['REQUEST_TIME']);
  • 拼音
echo format::pinyin('**');

gum's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.