• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • 位置: php 中文手册 -> PECL扩展库

    chdb(常量哈希数据库)

    Example #1 Creating a chdb file

    <?php
    $data = array(
        'key1' => 'value1',
        'key2' => 'value2',
        // ...
    );
    chdb_create('data.chdb', $data);
    ?>
    

    The above example will generate a chdb file nameddata.chdband containing the key-value pairs defined in$data.

    Example #2 Loading and looking up a chdb file

    <?php
    $chdb = new chdb('data.chdb');
    $value1 = $chdb->get('key1');
    $value2 = $chdb->get('key2');
    echo $value1, PHP_EOL;
    echo $value2, PHP_EOL;
    ?>
    

    以上例程的输出类似于:

    value1
    value2
    
    chdb 
    {
    	/* Methods */
    	public __construct ( string $pathname )
    	public get ( string $key ) : string
    }