PHP code example of cdyun / webman-response

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

    

cdyun / webman-response example snippets


use Cdyun\WebmanResponse\Response;

//获取配置
ResponseEnforcer::getConfig($name = null, $default = null);

//成功
ResponseEnforcer::success($msg = '操作成功', $data = null);

//失败
ResponseEnforcer::error($msg = '操作失败', $data = null);

//异常
ResponseEnforcer::abort($msg = '服务器内部错误', $code = null);

//分页
ResponseEnforcer::paginate( $data = [], $totalCount = 0, $msg = '加载完成');

//结果
ResponseEnforcer::result($result, $is_encrypt = false);

use Cdyun\WebmanResponse\EncryptorEnforcer;

//获取配置
ResponseEnforcer::getConfig($name = null, $default = null);

//RSA解密
EncryptorEnforcer::rsaDecrypt($data);

//AES解密
EncryptorEnforcer::aesDecrypt($data, $key, $iv);

//AES加密
EncryptorEnforcer::aesEncrypt($data, $key, $iv);

use Cdyun\WebmanResponse\middleware\DecryptMiddleware;