Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- - A simple KeyValue NoSQL DataBase using flat files!
- */
- namespace BTTM;
- class DataBase {
- function __construct() {
- if (!file_exists('{{base}}/db/')) mkdir('{{base}}/db/');
- }
- function get($key) {
- return file_get_contents('{{base}}/db/'.$key.'.txt');
- }
- function set($key, $val) {
- return file_put_contents('{{base}}/db/'.$key.'.txt', $val);
- }
- function delete($key) {
- return unlink('{{base}}/db/'.$key.'.txt');
- }
- function has($key) {
- return file_exists('{{base}}/db/'.$key.'.txt');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment