small changes
This commit is contained in:
parent
2335cead8e
commit
29bf96c718
@ -3,6 +3,7 @@
|
|||||||
class PHPJSONDB {
|
class PHPJSONDB {
|
||||||
static function put($db,$table,$item,$data) {
|
static function put($db,$table,$item,$data) {
|
||||||
global $phpjsondb_dbpath;
|
global $phpjsondb_dbpath;
|
||||||
|
if ( !isset($phpjsondb_dbpath) ) { $phpjsondb_dbpath="./db"; }
|
||||||
if ( !file_exists($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".data") ) {
|
if ( !file_exists($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".data") ) {
|
||||||
@mkdir($phpjsondb_dbpath."/".$db."/".$table,0755,TRUE);
|
@mkdir($phpjsondb_dbpath."/".$db."/".$table,0755,TRUE);
|
||||||
file_put_contents($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json",json_encode($data));
|
file_put_contents($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json",json_encode($data));
|
||||||
@ -10,6 +11,7 @@ class PHPJSONDB {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
static function get($db,$table,$item) {
|
static function get($db,$table,$item) {
|
||||||
|
if ( !isset($phpjsondb_dbpath) ) { $phpjsondb_dbpath="./db"; }
|
||||||
global $phpjsondb_dbpath;
|
global $phpjsondb_dbpath;
|
||||||
if ( file_exists($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json") ) {
|
if ( file_exists($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json") ) {
|
||||||
return json_decode(file_get_contents($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json"));
|
return json_decode(file_get_contents($phpjsondb_dbpath."/".$db."/".$table."/".md5($item).".json"));
|
||||||
|
Loading…
Reference in New Issue
Block a user