语法
HttpGet(context: any, url: string, cache?: boolean | number): string参数
| 名称 | 类型 | 描述 |
|---|---|---|
context | any | 调用方法样式帮助器时提供的自身或上下文参数。 |
url | string | 要连接的 HTTP 或 WebSocket URL。 |
cache? | boolean | number | 启用或禁用此行为的布尔选项。 |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
body | string | HTTP 响应正文。 |
说明
发送 GET 请求并返回响应正文。
使用 3 个参数调用: context, url, cache。参数表会说明哪些值必填,哪些值只用于细化行为。
返回 body (string)。使用返回表区分成功值、nil 结果和可恢复错误。
示例
使用占位值的示例调用。
local result = HttpGet(nil, "example", true)
print(result)