💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] ### 组件说明 > Lying的encrypter是内置组件,用于基础的数据加密。 ### 配置选项 | 配置名 | 参数类型 | 可选 | 默认值 | 说明 | | --- | --- | --- | --- | --- | | class | string | 是 | lying\service\Encrypter | 不可更改 | ### 示例配置 Encrypter组件暂时不需要配置,可直接使用 ### 调用方式 ~~~php \Lying::$maker->get('encrypter'); \Lying::$maker->encrypter(); \Lying::$maker->encrypter; ~~~ ### 方法列表 ~~~php /** * 位或加密 * @param mixed $data 要加密的数据 * @param string $key 密钥 * @param int $expire 过期时间戳 * @return string 返回密文 */ public function xorEncrypt($data, $key, $expire = 0); ~~~ * * * * * ~~~php /** * 位或解密 * @param string $data 密文字符串 * @param string $key 密钥 * @return bool|mixed 返回解密后的数据,失败返回false */ public function xorDecrypt($data, $key); ~~~