语法
base64_encode(data: string): string别名
base64encodebase64.encodecrypt.base64.encodecrypt.base64_encodecrypt.base64encode参数
| 名称 | 类型 | 描述 |
|---|---|---|
data | string | 要进行 Base64 编码的字符串。 |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
encoded | string | Base64 编码的字符串。 |
说明
将字符串编码为 Base64。
使用 1 个参数调用: data。参数表会说明哪些值必填,哪些值只用于细化行为。
返回 encoded (string)。使用返回表区分成功值、nil 结果和可恢复错误。
示例
对文本进行编码并将其解码回原始值。
local encoded = base64_encode("hello world")
local decoded = base64_decode(encoded)
print(encoded)
print(decoded)