企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## **字符串加密、解密函数** ``` /** * 字符串加密、解密函数 * @param string $txt 字符串 * @param string $operation ENCODE为加密,DECODE为解密,可选参数,默认为ENCODE, * @param string $key 密钥:数字、字母、下划线 * @param string $expiry 过期时间 * @return string */ auth($string, $operation = 'ENCODE', $key = '', $expiry = 0) ``` ## **获取配置基础信息** ``` /** * 获取配置基础信息 * @date 2018-07-12T17:08:40+0800 * @author ChenMingjiang * @param string $name [请求key值] * @param string $path [请求conf文件 默认config.php] * @return [type] [description] */ config($name = null, $path = '') ``` ## **Cookie操作** ``` /** * Cookie操作 * @date 2018-07-12T17:08:01+0800 * @author ChenMingjiang * @param string $name [名称] * @param string $value [值] * @param array $options [description] * prefix 名称前缀 * expire 过期时间 * @return [type] [description] */ cookie($name = '', $value = '', $options = []) ``` ## **转换其他编码成Unicode编码** ``` /** * 转换其他编码成Unicode编码 * @date 2017-10-10T15:24:33+0800 * @author ChenMingjiang * @param [type] $name [需要转换的内容] * @param string $code [当前编码] * @return [type] [description] */ enUnicode($name, $code = 'UTF-8') ``` ## **压缩字符串** ``` /** * [压缩字符串] * @date 2018-07-12T17:06:15+0800 * @author ChenMingjiang * @param [type] $value [字符串值] * @param string $operation [ENCODE为加密,DECODE为解密] * @return [type] [description] */ zipStr(stirng $value, $operation = 'ENCODE') ``` ## **获取GET/POST参数信息** ``` /** * GET过滤 * @date 2018-07-12T17:10:04+0800 * @author ChenMingjiang * @param [type] $name [名称] * @param string $type [过滤类型] * @param string $default [默认值] * @return [type] [description] */ get($name = null, $type = '', $default = '') post($name = null, $type = '', $default = '') 详细规则见http资源参数获取 ``` ## **创建Url地址** ``` /** * 创建url * ------------------------ * | {:url()} to /MODULE/CONTROLLER/ACTION * | {:url('xxxx')} to /MODULE/CONTROLLER/xxx * | {:url('/aaa/bbb/ccc/ddd')} to /aaa/bbb/ccc/ddd * | {:url('aaa/bbbb')} to /MODULE/aaa/bbb * ------------------------ * @date 2018-07-06T10:50:29+0800 * @author ChenMingjiang * @param [type] $location [请求URL] * @param array $params [description] * @param array $options [description] * host 前缀域名 * is_get 伪静态 true开启 false关闭 * is_route 路由改写 true开启 false关闭 * @return [type] [description] */ url($location = null, $params = [], $options = []) ``` ## **判断是否是手机访问** ``` /** * 判断是否是手机访问 * @date 2018-05-28T11:30:29+0800 * @author ChenMingjiang * @return boolean [description] */ isMobile(); ``` ## **curl模拟** ``` /** * curl模拟 * @date 2019-01-11T11:56:24+0800 * @author ChenMingjiang * @param [type] $url [请求地址] * @param string $method [请求类型 GET/POST/PUT/DELETE] * @param array $param [请求参数] * @param array $headers [请求头部信息] * @param array $options [配置项] * isJson(bool):是否返回json数据 默认是 * debug(bool): 是否开启调试模式 默认否 * ssl(array):证书认证地址 * is_code(bool):是否返回请求页面状态码 * out_time(int):指定超时时间 默认10秒 * @return [type] [description] */ response($url, $method = 'GET', $param = [], $headers = [], $options = []) ```