PHP code example of xcodecraft / xrest_utls

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

    

xcodecraft / xrest_utls example snippets


XCC\utls\v1

    XInput::ruleSetting($dataRoot . "/input.json") ;
    XInput::failSetting("\XInputException");
    list($name,$age,$limit) = XInput::safeArr($data,"name,age,limit") ;

 php

    $qCont             = new QueryDTO;
    $qCont->id         = 100 ;
    $qCont->limit      = '[0, 20]';
    $qCont->createtime = '[2016-2-1, 2016-3-1]';
    $qCont->order      = 'desc(id)';
    $sql               = XSql::where($qCont) ;

    $expect = "id = 100 and createtime >= 2016-2-1 and createtime <= 2016-3-1 order by id DESC limit 0, 20" ;
    $this->assertEquals($sql, $expect) ;