PHP code example of idrunk / dce

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

    

idrunk / dce example snippets


RedisProxy::new()->set('homepage', 'https://drunkce.com');

// 查一条
$row = db('member')->where('mid', 4100001221441)->find();
// db方法为实例化查询器的快捷方法

// 简单联合查询
$list = db('member', 'm')->join('member_role', 'mr', 'mr.mid = m.mid')->select();

// 较复杂的嵌套条件查询
$list = db('member')->where([
    ['is_deleted', 0],
    ['register_time', 'between', ['2021-01-01', '2021-01-31 23:59:59']],
    [
        ['level', '>', 60],
        'or',
        ['vip', '>', 1],
    ],
    ['not exists', raw('select 1 from member_banned where mid = member.mid')],
])->select();