PHP code example of mirrorgdit / php-helper

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

    

mirrorgdit / php-helper example snippets


composer 


use mirrorgdit\helper\PDOHelper;

//配置数组
//$configArr = [$host, $port, $username, $password, $dbname, $charset];
$configArr = ['localhost','3306','root','123456','mysql','utf8'];
$db = new PDOHelper($configArr);
$res = $db->getAll("select Host,User from user");
var_dump($res);


use mirrorgdit\helper\MemcachedHelper;

//Redis使用
$mem = new MemcachedHelper(['127.0.0.1', '6379']);
$mem->set('key', 'value', $expiration = 0);//存储
echo $mem->get('key');//获取


use mirrorgdit\helper\RedisHelper;

//Redis使用
$redis = new RedisHelper(['127.0.0.1', '6379']);
$redis->set('key', 'value');//存储
echo $redis->get('key');//获取