/// <summary> ? ? /// Post请求 ? ? /// </summary> ? ? /// <param name="requestBody"></param> ? ? /// <param name="url"></param> ? ? /// <returns></returns> ? ? public static IEnumerator PostHttpRequest(object requestBody,string url) ? ? { ? ? ? ? string body = JsonMapper.ToJson(requestBody); ? ? ? ? byte[] rawData = Encoding.UTF8.GetBytes(body); ? ? ? ? WWWForm form = new WWWForm(); ? ? ? ? System.Collections.Hashtable headers = new System.Collections.Hashtable(); ? ? ? ? headers["Content-Type"] = "application/json"; ? ? ? ? headers["Accept"] = "application/json"; ? ? ? ? WWW www = new WWW(url, rawData, headers); ? ? ? ? yield return www; ? ? ? ? Debug.Log("返回值:" + www.text); ? ? }
|