ไวยากรณ์
HttpPost(context: any, url: string, body?: string, contentTypeOrCompatibility?: string | number | boolean, headersOrContentType?: table | string, headers?: table): stringArguments
| ชื่อ | ชนิด | คำอธิบาย |
|---|---|---|
context | any | อาร์กิวเมนต์ตนเองหรือบริบทที่ให้มาเมื่อเรียกผู้ช่วยสไตล์วิธีการ |
url | string | HTTP หรือ WebSocket URL ที่จะเชื่อมต่อ |
body? | string | เนื้อหาคำขอที่ส่งไปพร้อมกับคำขอ HTTP |
contentTypeOrCompatibility? | string | number | boolean | ประเภทเนื้อหาหรือแฟล็กความเข้ากันได้สำหรับลายเซ็น HttpPost ดั้งเดิม |
headersOrContentType? | table | string | ตารางส่วนหัวหรือค่าชนิดเนื้อหา ขึ้นอยู่กับสไตล์การโทร |
headers? | table | ส่วนหัว HTTP ที่ส่งไปพร้อมกับคำขอ |
Returns
| ชื่อ | ชนิด | คำอธิบาย |
|---|---|---|
body | string | เนื้อหาการตอบสนอง HTTP |
คำอธิบาย
ส่งคำขอ POST และส่งคืนเนื้อหาการตอบกลับ
เรียกด้วย parameter 6 ค่า: context, url, body, contentTypeOrCompatibility, headersOrContentType, headers ตาราง arguments อธิบายค่าที่จำเป็นและค่าที่ปรับพฤติกรรม
ส่งคืน body (string) ใช้ตาราง returns เพื่อแยกค่าที่สำเร็จ ผลลัพธ์ nil และ error ที่จัดการต่อได้
ตัวอย่าง
ตัวอย่างการเรียกใช้ด้วยค่าตัวอย่าง
local result = HttpPost(nil, "example", "example", "example", "example", {})
print(result)