openssl_encrypt()加密函数
openssl_encrypt ( string $data , string $method , string $key [, int $options = 0 [, string KaTeX parse error: Expected 'EOF', got '&' at position 19: …= "" [, string &̲tag = NULL [, string $aad = “” [, int $tag_length = 16 ]]]]] ) : string
以指定的方式和 key 加密数据,返回原始或 base64 编码后的字符串。
参数:
data
待加密的明文信息数据。
method
密码学方式。openssl_get_cipher_methods() 可获取有效密码方式列表。
key
key。
options
options 是以下标记的按位或: OPENSSL_RAW_DATA 、 OPENSSL_ZERO_PADDING。
iv
非 NULL 的初始化向量。
tag
使用 AEAD 密码模式(GCM 或 CCM)时传引用的验证标签。
aad
附加的验证数据。
tag_length
验证 tag 的长度。GCM 模式时,它的范围是 4 到 16。
例:
public static