Home > Backend Development > PHP Tutorial > Tutorial on using LevelDB_PHP in PHP code

Tutorial on using LevelDB_PHP in PHP code

WBOY
Release: 2016-07-14 10:07:47
Original
982 people have browsed it

As we all know, LevelDB is only a C/C++ programming language library, so PHP cannot directly use LevelDB. If a PHP project wants to use LevelDB, one way is to develop it in C language and encapsulate LevelDB into a module of PHP. One approach is to encapsulate LevelDB as a web server.

The way to develop PHP's LevelDB module is not very applicable, because this mode limits it to a single-machine storage and must be on the same machine as PHP. Under the principle of separation of code and data, LevelDB is encapsulated into a Online services are a better choice.
SSDB is a LevelDB server (LevelDB Server), using LevelDB as the storage engine, supporting clients such as PHP/Java/Python/C/C++. The following is an example of PHP connecting to SSDB, that is, PHP using LevelDB:
require_once('SSDB.php');
$ssdb = new SSDB('127.0.0.1', 8888);
$resp = $ssdb->set('key', '123');
$resp = $ssdb->get('key');
echo $resp->data; // output: 123
See the SSDB project Wiki for the complete API.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477833.htmlTechArticleAs we all know, LevelDB is just a C/C++ programming language library, so PHP cannot use LevelDB directly. If If a PHP project wants to use LevelDB, one way is to develop it in C language and put...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template