PHP Classes

File: examples/testsimple.php

Recommend this page to a friend!
  Classes of Jorge Castro   PHP Document Store One   examples/testsimple.php   Download  
File: examples/testsimple.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Document Store One
Store and retrieve key-value pairs in flat files
Author: By
Last change:
Date: 4 years ago
Size: 534 bytes
 

Contents

Class file image Download
<?php
use eftec\DocumentStoreOne\DocumentStoreOne;

include
"../lib/DocumentStoreOne.php";
echo
"test<br>";
try {
   
$flatcon = new DocumentStoreOne(dirname(__FILE__) . "/base", 'tmp','folder');
   
} catch (
Exception $e) {
    die(
"Unable to create document store");
}

$sid=uniqid();

$doc=array('sid'=>$sid);

$flatcon->insertOrUpdate('test',json_encode($doc));

$docRead=json_decode($flatcon->get('test'),true);
/*
if ($docRead['sid']!=$sid) {
    throw new Exception("sid incorrect");
} else {
    echo "ok";
}
*/
echo "ok";