Use LevelDB in PHP code

Source: Internet
Author: User

As we all know, LevelDB is only a C/C ++ programming language library, so PHP cannot directly use LevelDB. if the PHP project wants to use LevelDB, one method is to develop it in C language, encapsulate LevelDB into a module of PHP, And the other method is to encapsulate LevelDB into a network server. the LevelDB module for PHP development is not highly applicable, because this mode limits that it must be stored on a single machine and must be on the same machine as PHP. with the principle of code and data separation, it is better to encapsulate LevelDB into a network service. SSDB is a LevelDB Server. It uses LevelDB as the storage engine and supports clients such as PHP, Java, Python, C, and C ++. the following is an example of connecting PHP to SSDB, that is, using LevelDB in PHP: <? Phprequire_once ('ssdb. php '); $ ssdb = new SSDB ('2017. 0.0.1 ', 8888); $ resp = $ ssdb-> set ('key', '000000'); $ resp = $ ssdb-> get ('key '); echo $ resp-> data; // output: 123 for the complete API, see the SSDB project Wiki.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.