对 URI 组件进行编码 (string.encode_uri_component)
声明
编码后的URI组件 = string.encode_uri_component(URI组件)
参数
- URI 组件
字符串型,URI 组件
返回值
- 编码后的 URI 组件
文本型,返回编码后的 URI 组件
说明
对 URI 组件中的特殊字符进行百分号编码;相比
string.encode_uri,会更为严格地转义/、?、&、=等保留字符
关键词:URI 组件编码
该函数在 20250313 以后版本方可使用
示例
nLog(string.encode_uri_component("https://www.example.com/测试")) -- https%3A%2F%2Fwww.example.com%2F%E6%B5%8B%E8%AF%95