# TPD-Tiny-PHP-Database **Repository Path**: RudonOpenSource/TPD-Tiny-PHP-Database ## Basic Information - **Project Name**: TPD-Tiny-PHP-Database - **Description**: The most tiny CURD database in a single PHP file, who is designed for no-more-service and the simple data managing. Leave your small PHP project away from MySQL etc. 全球最轻便的PHP单文件级数据库,CURD支持,OOP设计。数据加密储存在文件中,方便转移管理。 在无数据库服务的PHP空间中可以给你带来惊喜! - **Primary Language**: PHP - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-08-06 - **Last Updated**: 2023-01-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TPD-Tiny-PHP-Database #### 【介绍】 The most tiny CURD database in a single PHP file, who is designed for no-more-service and the simple data managing. Leave your small PHP project away from MySQL etc. Author: Rudon<285744011@qq.com> 全球最轻便的PHP单文件级数据库,CURD支持,OOP设计。数据加密储存在文件中,方便转移管理。 在无数据库服务的PHP空间中可以给你带来惊喜! 作者: Rudon<285744011@qq.com> #### 【版本】 - v1.1 [2022-06-30] - v1.0 [2020-08-06] #### 【特点】 1. 纯PHP驱动,无需安装,即放即用;无需后台服务,只占用极少量的I/O资源; 2. TPD密码不限,密码+数据库名为一个组合,决定数据库文件位置,建议使用统一密码; 3. 数据库、表、字段等无需提前预设,即插即用; 4. 表字段无需提前设计,只需要在插入时全字段插入即可; 5. 表字段数据长度、数据类型不限,推荐使用string,int,floor,boolean或者array作为数据类型; 6. TPD数据为明文储存,不适用于机密、金融等项目,请注意数据安全; #### 【使用方法】 ``` tpd = TPD\TPD::getInstance('DBname', 'password', '/full/path/of/top/folder/for/DB/'); } /** * CURD测试 */ public function test() { /* 测试数据 */ $table = 'student'; $oneRow = array( 'id' => 1, 'name' => 'Jack', 'age' => 10 ); $someRows = array( array( 'id' => 3, 'name' => 'Peter', 'age' => 8 ), array( 'id' => 4, 'name' => 'Lucy', 'age' => 9 ), array( 'id' => 5, 'name' => 'Kim', 'age' => 11 ) ); /* 清空表 */ $this->tpd->delete($table); /* 1.1 插入 */ $this->tpd->insert($table, $oneRow); /* 1.2 批量插入 */ $this->tpd->bulkInsert($table, $someRows); /* 2. 查询 */ $result1 = $this->tpd->select($table, array('id' => 1)); $result2 = $this->tpd->select($table, array('id' => 1, 'name' => 'haha')); $result3 = $this->tpd->select($table, array('id', '!=', 1)); $result4 = $this->tpd->select($table, array('id', '>', 2)); $result5 = $this->tpd->select($table, array('name', 'like', 'ter')); $result6 = $this->tpd->select($table, array( array('name', 'like', 'ter'), array('score', '<', 60) )); $result7 = $this->tpd->select($table, array('id', 'in', array(2,3,4))); $result8 = $this->tpd->select($table); echo '