Version: 2019.2
public byte[] data ;

説明

フォームを送信するときに POST のリクエストボディに渡す生のデータ(読み取り専用)

Usually, you just pass the WWWForm object directly to the WWW constructor, but you will need this variable if you want to change the request headers sent to the web server.

関連項目: headers 変数

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ExampleClass : MonoBehaviour { IEnumerator Start() { WWWForm form = new WWWForm(); form.AddField( "name", "value" ); Dictionary<string, string> headers = form.headers; byte[] rawData = form.data; string url = "www.myurl.com";

// Add a custom header to the request. // In this case a basic authentication to access a password protected resource. headers["Authorization"] = "Basic " + System.Convert.ToBase64String( System.Text.Encoding.ASCII.GetBytes("username:password"));

// Post a request to an URL with our custom headers using (WWW www = new WWW(url, rawData, headers)) { yield return www; //.. process results from WWW request here... } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961