PHP code example of hunzsig / h-php

1. Go to this page and download the library: Download hunzsig/h-php 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/ */

    

hunzsig / h-php example snippets



    define('CONFIG_PATH', __DIR__ . '/config.php'); // 可宏定义一个配置文件路径,覆盖原有的config
    $hphpPath = realpath(__DIR__ . '/h-php');
    nal('sql', __DIR__ . '/myExternal/sql.php');
    $hphp->run();

php ./h-php/hPackage.php -c ./config.php
php ./h-php/hPackage.php -c ./h-php/hPhp.config.php // 默认情况下
php ./h-php/hPackage.php -c ./verdor/hunzsig/h-php/hPhp.config.php // 默认composer情况下

php ./verdor/hunzsig/h-php/hPackage.php -c ./config.php

$this->db()->schemas('default')->table('system_data')
    ->field('key,value')
    ->in('key', $key)
    ->multi();

$this->db()->table('test')->equalTo('a',1)
    ->equalTo('b',1)
    ->closure('or')
    ->equalTo('c',1)
    ->equalTo('d',1)
    ->equalTo('e',1)
    ->closure('or');

$this->db()->table('test')
    ->equalTo('a',1)
    ->equalTo('b',1)
    ->closure('or')
    ->equalTo('c',1)
    ->equalTo('d',1)
    ->equalTo('e',1)
    ->closure('or',true);

try {
    $this->db()->schemas('default')->table('system_data')->insert($bean->toArray());
} catch (\Exception $e) {
    return $this->error($e->getMessage());
}

try {
    $this->db()->schemas('default')->table('system_data')->insert($bean->toArray());
    $lastId = $this->db()->lastInsertId();
} catch (\Exception $e) {
    return $this->error($e->getMessage());
}