| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Encrypt the JSON-type interface request and return data by using the RSA
<?php
namespace app\index\controller;
//引用RSACrypt加密类
use mrmiao\encryption\RSACrypt;
class Index
{
//在方法中实例化加密类
function encrypt(RSACrypt $crypt){
//调用request()方法获取请求参数,request方法可选参数数组['参数名'=>'强制转换类型']
$param = $crypt->request(['user_id'=>'int','mobile'=>'array','quest_time'=>'int','app_id'=>'string']);
//解析后参数变为明文数据
$param['php_add'] = '正常使用参数数据';
//调用response()方法返回数据,参数为数组
return $crypt->response(['code'=>200,'message'=>'success','data'=>$param],true);
}
}
```
| Back | FazBrowse Home | New Git URL |