WWW.responseHeaders

切换到手册
public Dictionary<string,string> responseHeaders ;

描述

请求返回的标头的字典。

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

public class ExampleClass : MonoBehaviour { public string url = "http://unity3d.com"; IEnumerator Start() { using (WWW www = new WWW(url)) { yield return www;

if (www.responseHeaders.Count > 0) { foreach (KeyValuePair<string, string> entry in www.responseHeaders) { Debug.Log(entry.Value + "=" + entry.Key); } } } } }

注意,在使用以下代码示例时,您需要在 Editor Settings 中将“WWW Security Emulation Host URL”设置为 "http://unity3d.com"。不这样做可能会抛出安全异常。

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961