1. Go to this page and download the library: Download kura-lab/php-kdb library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kura-lab / php-kdb example snippets
$ php composer.phar install
// sample.php
= new KDB("./users");
// Set data
$result = $kdb->set("hoge", "foo");
if (!$result) {
echo "Error: " . $kdb->getErrorCode() . "\n";
}
$value = json_encode(
array(
"bar"=>"huga",
"fuga"
)
);
$result = $kdb->set("tege", $value);
if (!$result) {
echo "Error: " . $kdb->getErrorCode() . "\n";
}
// Get data
$result = $kdb->get("hoge");
if ($result) {
var_dump($result);
} else {
echo "Error: " . $kdb->getErrorCode() . "\n";
}
$result = $kdb->get("tege");
if ($result) {
var_dump($result);
} else {
echo "Error: " . $kdb->getErrorCode() . "\n";
}